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

  1. //
  2. //    class IntThing  --  an integer thing derived from
  3. //                class Thing.
  4. //
  5. //    Version 1.01    --  2/25/91
  6. //
  7. //    Michael Kelly    --  Author
  8. //
  9. #include <stdio.h>
  10. #include "th_int.hpp"
  11.  
  12.  
  13. void IntThing::print()
  14. {
  15.     printf("%d\n", (int)*this);
  16. }
  17.  
  18. IntThing::operator ==(Thing &some_thing) 
  19.     return ( type() == some_thing.type() ) ?
  20.       ( *((int *)ptr()) == *((int *)some_thing.ptr()) ) : 0; 
  21. }
  22.  
  23. IntThing::operator !=(Thing &some_thing) 
  24.     return ( type() == some_thing.type() ) ?
  25.       ( *((int *)ptr()) != *((int *)some_thing.ptr()) ) : 0; 
  26. }
  27.  
  28.  
  29. IntThing::operator < (Thing &some_thing) 
  30.     return ( type() == some_thing.type() ) ?
  31.       ( *((int *)ptr()) <  *((int *)some_thing.ptr()) ) : 0; 
  32. }
  33.  
  34.  
  35. IntThing::operator <=(Thing &some_thing) 
  36.     return ( type() == some_thing.type() ) ?
  37.       ( *((int *)ptr()) <= *((int *)some_thing.ptr()) ) : 0; 
  38. }
  39.  
  40.  
  41. IntThing::operator > (Thing &some_thing) 
  42.     return ( type() == some_thing.type() ) ?
  43.       ( *((int *)ptr()) >  *((int *)some_thing.ptr()) ) : 0; 
  44. }
  45.  
  46.  
  47. IntThing::operator >=(Thing &some_thing) 
  48.     return ( type() == some_thing.type() ) ?
  49.       ( *((int *)ptr()) >= *((int *)some_thing.ptr()) ) : 0;
  50. }
  51.