home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume43 / gen / part02 / String.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-24  |  975 b   |  49 lines

  1. /*
  2. File: String.h
  3.  
  4. Author: Bruce Kritt
  5.  
  6. Description:
  7. */
  8.  
  9. class String
  10. {
  11. private:
  12.         // attributes
  13.  
  14.         char* v;
  15.         int length;
  16.  
  17.         // disallowed constructors
  18.  
  19.         String(void);
  20. public:
  21.         // allowed constructors
  22.  
  23.         String(const String& copy);
  24.         String(char* init);
  25.  
  26.         // destructor
  27.  
  28.         ~String(){delete[Length()+1] v;}
  29.  
  30.         // public services
  31.  
  32.         void GetContents(char* string) const {str_copy(string,v);}
  33.         int Length(void) const {return length;}
  34.  
  35.         // comparison operators
  36.  
  37.         friend int operator==(String lhs,String rhs);
  38.         friend int operator!=(String lhs,String rhs);
  39.         friend int operator<(String lhs,String rhs);
  40.         friend int operator>(String lhs,String rhs);
  41.         friend int operator<=(String lhs,String rhs);
  42.         friend int operator>=(String lhs,String rhs);
  43.  
  44. };      // end class String
  45.  
  46. // concatenation operator
  47.  
  48. extern String operator+(String lhs,String rhs);
  49.