/* * Author: Dr. Ricardo Morales * * -- AbstractStack * An abstact class that defines the basic operations of a * Stack Data Structure * * For Homework #5, your Stack implementation should derive * this class. * */ #ifndef ABSTRACTSTACK_H #define ABSTRACTSTACK_H template < typename T > class AbstractStack { public: // Purpose: clears the stack // Postconditions: the stack is now empty virtual void clear() = 0; // Purpose: push an element into the stack // Parameters: x is the value to push into the stack // Postconditions: x is now the element at the top of the stack, virtual void push(T x) = 0; // Purpose: pop the stack // Postconditions: the element formerly at the top of the stack has // been removed // Panic: if the stack is currently empty, PANIC! virtual void pop() = 0; // Purpose: looks at the top of the stack // Returns: a reference to the element currently on top of the stack // Panic: if the stack is currently empty, PANIC! virtual T& top() = 0; // Purpose: Checks if a stack is empty // Returns: 'true' if the stack is empty // 'false' otherwise virtual bool isEmpty() = 0; }; #endif