#ifndef _LSET_H_ #define _LSET_H_ #include using namespace std; template class Set { public: Set( ); Set( const Set & rhs ); const Set & operator= ( const Set & rhs ); ~Set( ); bool contains( const Object & x ) const; bool isEmpty( ) const; int getSize( ) const; void print( ostream & out = cout ) const; void makeEmpty( ); void insert( const Object & x ); void remove( const Object & x ); Set setUnion( const Set & rhs ) const; Set intersect( const Set & rhs ) const; private: struct Node { Object data; Node *next; Node( const Object & d = Object( ), Node *n = NULL ) : data( d ), next( n ) { } }; Node *first; int theSize; // Needed so getSize() is efficient. }; template ostream & operator<< ( ostream & out, const Set & x ) { x.print( out ); return out; } #endif