home *** CD-ROM | disk | FTP | other *** search
/ Microsoftware Monthly 19…2 Programming Power Tools / MASO9512.ISO / cpptutor / cpptutor.arj / EXAMPLES / EX08032.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-27  |  1.5 KB  |  40 lines

  1. // \EXAMPLES\EX08032.H
  2. //  modified implementation of the PhoneBk class
  3. //--------------------------------------------------------------
  4.  
  5. //  files in this example:
  6. // %F,15,EX08031.H%EX08031.H       definition of class String
  7. // EX08032.H       this file
  8. // %F,15,EX08031.CPP%EX08031.CPP     member functions of String
  9. // %F,15,EX08032.CPP%EX08032.CPP     member functions of PhoneBk
  10. // %F,15,EX0803.CPP%EX0803.CPP   main() to exercise this class
  11.  
  12. //--------------------------------------------------------------
  13.  
  14. #ifndef PHONEBK_H
  15. #define PHONEBK_H
  16.  
  17. #include <iostream.h>               // for stream I/O
  18. #include "EX08031.H"                // definition of class String
  19.  
  20. //--------------------------------------------------------------
  21. // Definition of a class PhoneBk
  22. //--------------------------------------------------------------
  23.  
  24. class PhoneBk {
  25.   String names[100];                 // room for 100 names
  26.   long tel[100];                     // room for 100 numbers
  27.   int numEntry;                      // number of entries so far
  28. public:
  29.   PhoneBk () { numEntry = 0; };      // default constructor
  30.   PhoneBk ( const PhoneBk& oldbook); // copy constructor
  31.   ~PhoneBk () {};                    // destructor
  32.   int insert( char* who, long telnum); // insert or change entry
  33.   int remove( char* who);            // remove entry for name
  34.   long lookup(char* who);            // look up number for name
  35.   ostream& print(ostream& os);       // print the phonebook
  36. };
  37.  
  38. #endif
  39. //--------------------------------------------------------------
  40.