< previous page
page_874
next page >
Page 874
Set (In: newMonth, newDay, newYear)
Set mo = newMonth
Set day = newDay
Set yr = newYear
Month()
Out: Function value
Return mo
Day()
Out: Function value
Return day
Year()
Out: Function value
Return yr
Testing: The
Month
,
Day
, and
Year
observer functions can be used to verify that the class constructor and
Set
functions work correctly. The code
DateType someDate;
cout << someDate.Month() < < someDate.Day() <
< someDate.Year() < endl;
should print out 1 1 1583. To test the
Set
function, it is sufficient to set a
DateType
object to a few different values (obeying the precondition for the
Set
function), then print out the month, day, and year as above.
< previous page
page_874
next page >