- 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. 5-9 enhances class Time to demonstrate how arguments are implicitly passed to a constructor.
Figure 5:
Time class containing a constructor with default arguments.
|
Figure 6:
Time class member-function definitions including a constructor that takes arguments. (part 1 of 2)
|
Figure 7:
Time class member-function definitions including a constructor that takes arguments. (part 2 of 2)
|
Figure 8:
Constructor with default arguments. (part 1 of 2)
|
Figure 9:
Constructor with default arguments. (part 2 of 2)
|
2004-07-01