- Example Date class. The class uses overloaded preincrement and postincrement operators
to add 1 to the day in a Date object, while causing appropriate increments to the month and year if necessary.
- Overloaded increment operator; Change day, month and year
- Overloaded += operator
- Function to test for leap years
- Function to determine if day is last of month
Figure 3.22:
Date class definition with overloaded increment operator.
|
Figure 3.23:
Date class member-and friend-function definition. (part 1 of 3)
|
Figure 3.24:
Date class member-and friend-function definition. (part 2 of 3)
|
Figure 3.25:
Date class member-and friend-function definition. (part 3 of 3)
|
Figure 3.26:
Date class test program.
|
Figure 3.27:
Date class test program, output.
|
2004-07-29