//myq4.h -- queue using vector (not GOOD) #ifndef __MYQ4__ #define __MYQ4__ #include using namespace std; template class MyStack : vector { // actually is a queue public: void push(const T& y) { MyStack::push_back(y); } T top( ) { return MyStack::front( ); return vector::front( ); // OK too //return this -> front( ); // this is also OK } void pop( ) { MyStack::erase( MyStack::begin( ) ); } bool empty( ) { return MyStack::begin() == MyStack::end(); } }; #endif