Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * [ArrayBasedStack.h]
- * The ArrayBasedStack class declaration/specification.
- */
- #ifndef ARRAYBASEDSTACK_H
- #define ARRAYBASEDSTACK_H
- #include <iostream>
- const int MAX_LENGTH = 500; // the maximum size of the stack
- class ArrayBasedStack
- {
- /**
- * Everything under public can be accessed by all other programs or classes.
- */
- public:
- /**
- * Constructor(s):
- */
- ArrayBasedStack();
- /**
- * Mutators:
- */
- void Push(float);
- /**
- * Accessors:
- */
- void Pop(float &);
- /**
- * General Use:
- */
- void MakeEmpty(void); // empties the stack
- bool IsEmpty(void); // returns true if the stack is empty
- bool IsFull(); // returns true if the stack is full
- /**
- * Everything under protected can be accessed only by the class itself or (derived) subclasses,
- * as in the case of inheritance.
- */
- protected:
- /**
- * (Private) DATA MEMBERS/PROPERTIES:
- *
- * Everything under private can only be accessed by the class itself (the code in the
- * implementation file).
- */
- private:
- int top; // a value representing the top of the stack
- float data[MAX_LENGTH]; // the array to be used as the (LIFO) stack
- };
- #endif // ARRAYBASEDSTACK_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement