(see Figs. 1.8-1.10)
- Separating interface from implementation
- Advantage; Easier to modify programs
- Disadvantage
- Header files
- Portions of implementation; Inline member functions
- Hints about other implementation; private members
- Can hide more with proxy class
- Header files
- Class definitions and function prototypes
- Included in each file using class; #include
- File extension .h
- Source-code files
- Member function definitions
- Same base name; Convention
- Compiled and linked
Figure 1.8:
Time class definition and Time class member-function definitions (part 1 of 2).
|
Figure 1.9:
Time class member-function definitions (part 2 of 2).
|
Figure 1.10:
Program to test class Time.
|
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2004-12-28