home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_7 / 1.ddi / CLASSINC.ZIP / LSTELEM.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-13  |  1.7 KB  |  83 lines

  1. // Borland C++ - (C) Copyright 1991 by Borland International
  2.  
  3. // Contents ----------------------------------------------------------------
  4. //
  5. //      ListElement
  6. //
  7. // Description
  8. //
  9. //      Defines the class ListElement.  ListElements are used in objects
  10. //      which link other objects together and nowhere else.
  11. //
  12. // End ---------------------------------------------------------------------
  13.  
  14. // Interface Dependencies ---------------------------------------------------
  15.  
  16. #ifndef __LSTELEM_H
  17. #define __LSTELEM_H
  18.  
  19. #ifndef __IOSTREAM_H
  20. #include <iostream.h>
  21. #define __IOSTREAM_H
  22. #endif
  23.  
  24. #ifndef __CLSTYPES_H
  25. #include "clstypes.h"
  26. #endif
  27.  
  28. #ifndef __OBJECT_H
  29. #include "object.h"
  30. #endif
  31.  
  32. // End Interface Dependencies ------------------------------------------------
  33.  
  34. // Class //
  35.  
  36. class ListElement
  37. {
  38. public:
  39.             ListElement( Object *o ) { data = o; next = 0; }
  40.             ~ListElement() { delete data; }
  41.  
  42. private:
  43.             ListElement *next;
  44.             Object      *data;
  45.     friend class List;
  46.     friend class ListIterator;
  47. };
  48.  
  49. // Description -------------------------------------------------------------
  50. //
  51. //     Defines the abstract class ListElement. 
  52. //
  53. //     ListElement objects, i.e. objects instantiated of classes derived from
  54. //     ListElement, are used in sequences where insertions and deletions
  55. //     are defined.
  56. //
  57. // Public Members
  58. //
  59. //  none
  60. //
  61. // Private Members
  62. //
  63. //     next
  64. //
  65. //     Pointer to the next list element.
  66. //
  67. //     data
  68. //
  69. //     Pointer to the list element's data.
  70. //
  71. // Friends
  72. //
  73. //     class List
  74. //
  75. //     The class which uses class ListElement, class List, is declared
  76. //     as a friend.
  77. //
  78. // End ---------------------------------------------------------------------
  79.  
  80.  
  81. #endif // ifndef __LSTELEM_H //
  82.  
  83.