0001 #include "Vector/Vector.h" 0002 template <typename T> struct Stack: public Vector<T> { //由Vector派生出Stack 0003 void push(const T& e) { insert(e); } //入栈:插入末元素 0004 T pop() { return remove(_size-1); } //出栈:删除末元素 0005 T& top() { return _elem[_size-1]; } //取顶:末元素 0006 }; //Stack:相当于将水平向量逆时针旋转90度