home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_11_07 / 1107124a < prev    next >
Text File  |  1993-05-06  |  451b  |  30 lines

  1. //
  2. // list.h - list interface using a nested class
  3. // with a static data member for counting the object
  4. //
  5.  
  6. class list
  7.     {
  8. public:
  9.     list(unsigned n);
  10.     ~list();
  11.     void add(unsigned n);
  12.     void print();
  13.     static unsigned howmany();
  14. private:
  15.     struct node
  16.         {
  17.         node(unsigned n, node *p);
  18.         unsigned number;
  19.         node *next;
  20.         };
  21.     node *first, *last;
  22.     static unsigned count;
  23.     };
  24.  
  25. inline unsigned list::howmany()
  26.     {
  27.     return count;
  28.     }
  29.  
  30.