home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_11 / 11.ddi / CLASSSRC.ZIP / SET.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-13  |  2.3 KB  |  100 lines

  1. // Borland C++ - (C) Copyright 1991 by Borland International
  2.  
  3.  
  4. // Contents ----------------------------------------------------------------
  5. //
  6. //
  7. // Description
  8. //
  9. //      Implementation of member functions for class Set.
  10. //
  11. // End ---------------------------------------------------------------------
  12.  
  13. // Interface Dependencies ---------------------------------------------------
  14.  
  15. #ifndef __CLSTYPES_H
  16. #include <clstypes.h>
  17. #endif
  18.  
  19. #ifndef __SET_H
  20. #include <set.h>
  21. #endif
  22.  
  23. // End Interface Dependencies ------------------------------------------------
  24.  
  25. // Implementation Dependencies ----------------------------------------------
  26. // End Implementation Dependencies -------------------------------------------
  27.  
  28.  
  29. // Member Function //
  30.  
  31. Set::~Set()
  32.  
  33. // Summary -----------------------------------------------------------------
  34. //
  35. //      Destructor for a Set object.
  36. //
  37. //        We don't do anything here, because the destructor for HashTable
  38. //        will take care of destroying the contained objects.
  39. //
  40. // End ---------------------------------------------------------------------
  41. {
  42. }
  43. // End Destructor //
  44.  
  45.  
  46. // Member Function //
  47.  
  48. classType Set::isA() const
  49.  
  50. // Summary -----------------------------------------------------------------
  51. //
  52. //      Returns the class type of a set.
  53. //
  54. // End ---------------------------------------------------------------------
  55. {
  56.     return setClass;
  57. }
  58. // End Member Function Set::isA //
  59.  
  60.  
  61. // Member Function //
  62.  
  63. char *Set::nameOf() const
  64.  
  65. // Summary -----------------------------------------------------------------
  66. //
  67. //      Returns a pointer to the character string "Set".
  68. //
  69. // End ---------------------------------------------------------------------
  70. {
  71.     return "Set";
  72. }
  73. // End Member Function Set::isA //
  74.  
  75.  
  76. // Member Function //
  77.  
  78. void Set::add( Object& objectToAdd )
  79.  
  80. // Summary -----------------------------------------------------------------
  81. //
  82. //      Adds an object to the set.  Sets may have only one copy of an object
  83. //      in the set at any time.
  84. //
  85. // Parameters
  86. //
  87. //      objectToAdd
  88. //
  89. // End ---------------------------------------------------------------------
  90. {
  91.     if ( !(Bag::hasMember( objectToAdd )) )
  92.     {
  93.         Bag::add( objectToAdd );
  94.     }
  95. }
  96. // End Member Function Set::add //
  97.  
  98.  
  99.  
  100.