home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / pascal / rehack / contain / contain.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-21  |  896 b   |  38 lines

  1. #include "contain.h"
  2.  
  3. containable::~containable() {}     /* stub */
  4.  
  5. container::container()
  6.  {
  7.   object_count = 0;
  8.  }
  9.  
  10. container::~container() {}
  11.  
  12.   // The following types really needn't be defined, since
  13.   // containable, sortable, and hashable are meant to be abstract.
  14.   // There are defined solely as examples.
  15.  
  16. const int containable::type = 0;
  17. const int sortable::type = 1;
  18. const int hashable::type = 2;
  19.  
  20. int containable::class_type() const { return type; }
  21. int sortable::class_type() const    { return type; }
  22. int hashable::class_type() const    { return type; }
  23.  
  24. int containable::descends_from(int arg) const
  25.  {
  26.   return arg == type;
  27.  };
  28.  
  29. int sortable::descends_from(int arg) const
  30.  {
  31.   return arg == type || containable::descends_from(arg);
  32.  }
  33.  
  34. int hashable::descends_from(int arg) const
  35.  {
  36.   return arg == type || containable::descends_from(arg);
  37.  }
  38.