**fig3_6.txt** /* 1*/ template /* 2*/ class List /* 3*/ { /* 4*/ protected: /* 5*/ // The list is a linked list with a header node. /* 6*/ struct Node /* 7*/ { /* 8*/ Etype Element; /* 9*/ Node *Next; /*10*/ // Constructor for node. /*11*/ Node( Etype E = 0, Node *N = NULL ) : /*12*/ Element( E ), Next( N ) { } /*13*/ }; /*14*/ Node *List_Head; /*15*/ Node *Current_Pos; /*16*/ void Destroy_List( ); // An incorrect routine in Fig. 3.15. /*17*/ void Delete_List( ); // The correct routine in Fig. 3.16. /*18*/ List( List & Value ); // Disable call by value. /*19*/ public: /*20*/ // Constructor. /*21*/ List( ) : List_Head ( new Node ), Current_Pos( List_Head ) { } /*22*/ /*23*/ // Destructor. /*24*/ virtual ~List( ) { Delete_List( ); } /*25*/ // Operators. /*26*/ const List & operator = ( List & Value ); /*27*/ const List & operator ++ ( ); /*28*/ int operator ! ( ) const; /*29*/ Etype operator ( ) ( ) const; /*30*/ // Member functions. /*31*/ int Is_Empty( ) const { return List_Head->Next == NULL; } /*32*/ virtual int Find( const Etype & X ); /*33*/ virtual int Find_Previous( const Etype & X ); /*34*/ int In_List( const Etype & X ); /*35*/ void First( ) { if( List_Head->Next != NULL ) /*36*/ Current_Pos = List_Head->Next; } /*37*/ void Header( ) { Current_Pos = List_Head; } /*38*/ int Remove( const Etype & X ); /*39*/ virtual void Insert( const Etype & X ); /*40*/ virtual void Insert_As_First_Element( const Etype & X ); /*41*/ };