Source of date2.h


  1: // Filename: DATE2.H
  2: // Purpose:  Specification file for a simple Date class.

  4: class Date
  5: {
  6: public:
  7:     Date(/* in */ int         newMonth,
  8:          /* in */ int         newDay,
  9:          /* in */ int         newYear,
 10:          /* in */ const char* messageString);
 11:     // Constructor
 12:     // Pre:      1 <= newMonth <= 12
 13:     //       and 1 <= newDay   <= maximum number of days in newMonth
 14:     //       and 1970 <= newYear
 15:     //       and messageString is initialized
 16:     // Post: New class object is constructed with a date of newMonth, 
 17:     //       newDay, newYear and the message string in messageString.

 19:     void Display() const;
 20:     // Pre:  self is initialized.
 21:     // Post: Date and message have been output in the form
 22:     //       month day, year       message
 23:     //       in which the name of the month is displayed as a string,
 24:     //       and the message string is displayed on the line beneath
 25:     //       the date.

 27:     ~Date();
 28:     // Destructor
 29:     // Pre:  self is initialized.
 30:     // Post: Message string pointed to by messagePtr has been deleted.

 32: private:
 33:     int   day;
 34:     int   month;
 35:     int   year;
 36:     char* messagePtr;
 37: };