home *** CD-ROM | disk | FTP | other *** search
- // \EXAMPLES\EX08063.H
- // definition of classes List, and ListIter
- //--------------------------------------------------------------
-
- // files in this example:
- // %F,15,EX08061.H%EX08061.H definition of class String
- // %F,15,EX08062.H%EX08062.H definition of class PhoneNum
- // EX08063.H this file
- // %F,15,EX08064.H%EX08064.H definition of class PhoneBk
- // %F,15,EX08061.CPP%EX08061.CPP member functions of class String
- // %F,15,EX08062.CPP%EX08062.CPP member functions of the class PhoneNum
- // %F,15,EX08063.CPP%EX08063.CPP member functions List and ListIter
- // %F,15,EX08064.CPP%EX08064.CPP member functions of class PhoneBk
- // %F,15,EX0806.CPP%EX0806.CPP main to exercise PhoneBk class
- //--------------------------------------------------------------
- #ifndef INCLPHL_H
- #define INCLPHL_H
-
- //--------------------------------------------------------------
- #include "EX08062.H"
-
- //--------------------------------------------------------------
- // Definition of class List
- //--------------------------------------------------------------
-
- class List {
- PhoneNum* list; // list of PhoneNum objects
- int last; // last occupied spot in list
- friend class ListIter; // iterator class
- public:
- List(int maxsize = 100); // default size 100
- ~List (); // destructor
- void add(PhoneNum& entry); // add an entry
- void del(PhoneNum* entry); // delete entry
- };
-
- //--------------------------------------------------------------
- // Definition of a class ListIter, iterator for class List
- //--------------------------------------------------------------
-
- class ListIter {
- int current; // index current entry
- public:
- ListIter() : current(-1) {}; // constructor
- ~ListIter() {}; // destructor
- PhoneNum* next( const List& list);// iterator function
- };
-
- //--------------------------------------------------------------
- #endif
-