欢迎来到天天文库
浏览记录
ID:34430661
大小:963.08 KB
页数:17页
时间:2019-03-06
《类设计与实现举例》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、类设计与实现举例DesigningClasses:FromRequirementstoImplementationRequirementRequirementWhatclasses?•Nounsasclasses–quiz,question,problem,student,computer,keyboard,chanceMemberFunctions•VerbsasMemberFunctions(Methods)–Classbehavior•Publicmemberfunctions–Responsibility•Methodsassociatedwiththeclassa
2、ndtheinteractionsbetweenclassesFindingVerbsUsingScenariosEnterName,ChooseNumberOfQuestions,ChooseKindOfQuestion,RespondToQuestion,GetCorrectAnswer,GetScore,AskQuestion,ProvideFeedbackWhichoftheseverbsgoeswithwhichclass?AssigningResponsibilities•NotallresponsibilitieswillbeassignedtoaclassI
3、mplementingandTestingClassesImplementingtheClassQuiz•[JohnBentley1988]•howtheQuizknowswhichstudenttoask?•ItcorrespondstohowStudentobjectsaredefinedandused•Codeofgivingaquiztotwostudents•designthefunctionQuiz::GiveQuestionTo()ImplementingtheClassQuestionReference•http://www.cs.duke.edu/csed
4、/tapestry/final7.pdf
此文档下载收益归作者所有