home *** CD-ROM | disk | FTP | other *** search
- // \EXAMPLES\EX10011.H
- //--------------------------------------------------------------
- // definition of the class String
- //--------------------------------------------------------------
-
- // files in this example:
- // EX10011.H this file
- // %F,15,EX10012.H%EX10012.H definition of the classes
- // PhoneNum, List, and ListIter
- // %F,15,EX10013.H%EX10013.H definition of the class PhoneBk
- // %F,15,EX10011.CPP%EX10011.CPP member functions of the class String
- // %F,15,EX10012.CPP%EX10012.CPP member functions of the classes
- // PhoneNum, List, and ListIter
- // %F,15,EX10013.CPP%EX10013.CPP member functions of the class PhoneBk
- // %F,15,EX1001.CPP%EX1001.CPP main() to exercise this class
-
- #ifndef STRCLASS_H
- #define STRCLASS_H
-
- #include <iostream.h> // needed or output stream
-
- class String { // data members
- char* text; // pointer to the characters
- int len; // number of chars in String
- int size; // allocated space for chars
- public: // member functions
- String(int maxlen = 0); // default constructor
- String( const String& s); // copy constuctor
- String( char* s); // convert char* to String
- ~String(); // destructor
- int compare(const char* t) const; // compare string to char*
- void append( const char* t); // add chars to a String
- ostream& print(ostream& os) const; // print chars in a String
- String& operator=( const String& s);// assignment operator
- };
-
- #endif
-