/*------------------------------------------------------------------------* * programm : S T A C K . H P P * * date : 05.11.1992 * * created by : (fa) * * Projekt MEE * * * *------------------------------------------------------------------------*/ // // Contents ------------------------------------------------- // // Stack // // Description // // Defines the class Stack for general use // // End ------------------------------------------------------ // // Implementation Dependencies ------------------------------ #include #include #ifndef __STACK_H #define __STACK_H // End ------------------------------------------------------ // Class // class Stack; // forward deklaration class Stack_element{ friend Stack; protected: Stack_element *next; Element * object; Stack_element( Stack_element *_next=NULL){ next=_next; } }; class Stack{ protected: int itemsInStack; // number of stack items 1...n Stack_element *top; public: Stack(); ~Stack(); void Push( Element & ); Element& Pop(); Element& Top(); int isNotEmpty(); void forEach(void (Element::*)()); }; // Description ---------------------------------------------- // // Public Members // // Push // Pushes an object on the stack // // Pop // Pops an object from the stack // // Top // Returns a refrence to the object on the top of the stack // // isNotEmpty // Returns NULL when stack is empty, other number of objects // in stack // // forEach // // End ------------------------------------------------------ #endif // ifndef __STACK_H