home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_06 / 9n06061a < prev    next >
Text File  |  1991-02-25  |  979b  |  52 lines

  1. //  class StructThing    --  a struct thing derived from
  2. //                class Thing.
  3. //
  4. //    Version 1.01    --  2/25/91
  5. //
  6. //    Michael Kelly    --  Author
  7. //
  8. #if !defined(TH_STRUC_HPP)
  9. #define TH_STRUC_HPP
  10.  
  11. #include "thing.hpp"
  12.  
  13. struct a_struct  {
  14.     char  key[ 16 ];
  15.     int   id;
  16. };
  17.  
  18. class StructThing : public Thing  {
  19.  
  20.   public:
  21.  
  22.     StructThing() 
  23.     { 
  24.     thing = new a_struct; 
  25.     }
  26.     StructThing( a_struct &some_thing ) 
  27.     { 
  28.     thing = new a_struct(some_thing); 
  29.     }
  30.  
  31.     long type()    
  32.     { 
  33.     return ( (long)StructType << 16) | sizeof(a_struct); 
  34.     }
  35.  
  36.     operator a_struct() { return *( (a_struct *)ptr() ); }
  37.  
  38.     void print();
  39.     int  printable() { return 1; }
  40.     int  sortable()  { return 1; }
  41.  
  42.  
  43.     operator ==(Thing &some_thing);
  44.     operator !=(Thing &some_thing);
  45.     operator < (Thing &some_thing);
  46.     operator <=(Thing &some_thing);
  47.     operator > (Thing &some_thing);
  48.     operator >=(Thing &some_thing);
  49. };
  50.  
  51. #endif
  52.