// File: HStack2.h // // A heterogeneous stack, derived from HList.h // // This version has code in a .h file !!!! Bad! // #ifndef HSTACK_H #define HSTACK_H #include "HList.h" class HStack : private HList { public: // Constructors HStack () { } HStack (const HStack& S) : HList(S) { } // Destructor ~HStack() { } // Assignment const HStack& operator=(const HStack& rhs) { HList::operator=(rhs) ; return *this ; } // Stack operations void push(HNode *ptr) { push_front(ptr) ; } void pop() { pop_front() ; } HNode *top() { front() ; } // Expose some HList public members using HList::print ; using HList::size ; } ; ostream& operator<< (ostream& os, const HStack& S) { S.print(os) ; return os ; } #endif