home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / BIDSAPI.PAK / MYCLASS.H < prev   
C/C++ Source or Header  |  1995-08-29  |  2KB  |  72 lines

  1. // ---------------------------------------------------------------------------
  2. // Copyright (C) 1994 Borland International
  3. //  myclass.h
  4. //                                                              
  5. // Description:                                                 
  6. //    This header file is provided to demonstrate the container 
  7. //       class libraries.                                       
  8. //    This implements the user-defined class.                   
  9. //    It defines the following member functions:                
  10. //       (required for the direct containers)                   
  11. //     - Copy constructor                                       
  12. //     - Assignment operator                                    
  13. //     - comparison operators ( ==, < )                         
  14. //     - HashValue (only needed for the HashTable containers)   
  15. //                                                              
  16. //    Define DEBUG to see when the constructors and destructors 
  17. //       are called. This is useful to track down memory leaks. 
  18. // ---------------------------------------------------------------------------
  19. #ifndef MYCLASS_H          // prevent header from
  20. #define MYCLASS_H 1        // being included twice
  21.  
  22. #include <cstring.h>
  23. #include <iostream.h>
  24. #include <checks.h>
  25.  
  26. class MyClass
  27. {
  28.   public:
  29.     MyClass();
  30.     MyClass(const string& s);
  31.     MyClass(const MyClass& mc);
  32.  
  33.     ~MyClass();
  34.     
  35.     MyClass& operator=(const MyClass& mc);
  36.     int operator==(const MyClass& mc) const;
  37.     int operator<(const MyClass& mc) const;
  38.     unsigned HashValue() const;
  39.     
  40.     friend ostream& operator << (ostream&, const MyClass);
  41.  
  42.   private:
  43.  
  44.     string Str;
  45. };
  46.  
  47. // 
  48. // MyValue is to be used with TAssociation or TDictionary.
  49. // 
  50. class MyValue
  51. {
  52.   public:
  53.     MyValue();
  54.     MyValue(const string& s);
  55.     MyValue(const MyValue& mv);
  56.     
  57.     ~MyValue();
  58.   
  59.     MyValue& operator=(const MyValue& mv);
  60.     int operator==(const MyValue& mv) const;
  61.     int operator<(const MyValue& mv) const;
  62.     unsigned HashValue() const;
  63.  
  64.     friend ostream& operator << (ostream&, const MyValue);
  65.  
  66.   private:
  67.  
  68.     string Str;
  69. };
  70.  
  71. #endif
  72.