CPS 6, Ramm - Summer Semester I - 6/8/99 #13
Chap 7. Class Design and Implementation via Simulation
- Walk Oberver Class (1-D)
- Passing a Class by Value/Reference
- Done for strings many times...
-
scopedice.cc
- Other Tools for Designing Classes
- Enumerated Types - Syntax
-
enum identifier {value, ..., value};
-
enum identifier
{value=int, ..., value=int};
- The Coin Class
-
flip.cc
-
coin.h
-
coin.cc
- Initializer Lists - Syntax
- ClassName::ClassName()
- :
- myVar1(argument),
- myVar2(argument),
- ...
- myVarN(argument)
- {// begin constructor body ...
- Structs
- Similarity to Class
- All Public, No Private
- Can Have Member Functions
- An Aggregate of Dissimilar Types
- Example (without member functions)
- struct Student
- {
- string name;
- int height; // height in inches
- double weight; // weight in pounds
- string dob; // date of birth mm/dd/yy
- }
Chap 8. Arrays, Data, & Random Access