CPS 6, Ramm - Spring 2000 - 2/23/00 #15
Chapt 6. Classes, Iterators, and Patterns
- Group Work: Ref Parameters
- More Reference Parameters (tricky)
-
ref.cpp
Chap 7. Class Interfaces, Design, and Implementation
- Switch Statement
- switch ( expression )
- {
- case constant1:
- statement list;
- break;
- case constant2:
- statement list;
- break;
- ...
- default:
- statement list;
- }
- Example Using the Switch Statement
- Work on Class Design: The Quiz Class
-
First look at traditional style program
-
simpquiz2.cpp
- Consider a Class Design: Requirements
- More than one kind of question
- Several students share keyboard
- More than one chance to answer
- Class Design: Assigning Responsibilities
- Student
- Construct using name
- RespondTo a question
- GetScore
- GetName
- Quiz
- ChooseKindOfQuestion
- AskQuestion of/GiveQuestion to a student
- Question
- Create/Construct question type
- AskQuestion
- Get CorrectAnswer
- Implementing and Using Classes
- Iterative Enhancement
- Using Stubs
teststudent.cpp
- Going for Class