- Constructors
- Can specify default arguments
- Default constructors
- Defaults all arguments
- OR
- Explicitly requires no arguments
- Can be invoked with no arguments
- Only one per class
The program of Figs. 1.17-1.21 enhances class Time to demonstrate how arguments are implicitly passed to a constructor.
Figure 1.17:
Time class containing a constructor with default arguments.
|
Figure 1.18:
Time class member-function definitions including a constructor that takes arguments. (part 1 of 2)
|
Figure 1.19:
Time class member-function definitions including a constructor that takes arguments. (part 2 of 2)
|
Figure 1.20:
Constructor with default arguments. (part 1 of 2)
|
Figure 1.21:
Constructor with default arguments. (part 2 of 2)
|
2004-07-29