Source of telnum.h


  1: // Filename: TELNUM.H
  2: // Purpose:  Specification file for a TelephoneNumber class.

  4: class TelephoneNumber
  5: {
  6: public:

  8:     TelephoneNumber();
  9:     // Pre:  none
 10:     // Post: The telephone number has been initialized to (902)555-1212.

 12:     TelephoneNumber(/* in */ int areaCode,
 13:                     /* in */ int number);
 14:     // Pre:  "areaCode" and "number" have been initialized.
 15:     // Post: The values of "areaCode" and "number" have been used
 16:     //       to store the telephone number information.

 18:     void Display() const;
 19:     // Pre:  "self" has been initialized.
 20:     // Post: "self" is displayed in the form illustrated by:
 21:     //       (902)425-5790

 23:     int AreaCode() const;
 24:     // Pre:  "self" has been initialized.
 25:     // Post: Return-value is the three-digit value of the
 26:     //       area code in "self"

 28:     int LocalNumber() const;
 29:     // Pre:  "self" has been initialized.
 30:     // Post: Return-value is the seven-digit "local" telephone
 31:     //       number part of "self", without the '-', as in
 32:     //       4205790

 34: private:
 35:     int area;
 36:     int exchange;
 37:     int line;
 38: };