#ifndef __STACK_H__ #define __STACK_H__ // This is something briefly discussed in lecture. We need to say // that there's going to be a struct called 'IntStackNode', because the // IntStack class needs to point to one. But we don't need to say what // IntStackNode looks like right now, so we leave it out. The definition // of the IntStackNode struct is in stack.cpp. struct IntStackNode; class IntStack { public: // Default constructor that builds an empty IntStack. IntStack(); // Destructor function. For more information about destructors, see // section 7.8 of the textbook. ~IntStack(); // Copy constructor. Again, see section 7.8. IntStack( const IntStack& other ); // Overloaded assignment operator. Section 7.8 again. IntStack& operator =( const IntStack& other ); bool isEmpty(); // Is the stack empty? void push( int item ); // Push an element onto the stack. int pop(); // Pop the top element from the stack. int top(); // Get the top element from the stack. private: void delAll(); void pushAllFrom( IntStackNode *other ); IntStackNode *ptop; // A pointer to the top of the stack. }; #endif // __STACK_H__