|
Stack Class Reference#include <StackA.h>
List of all members.
Detailed Description
ADT stack - Array-based implementation.
Definition at line 23 of file StackA.h.
Constructor & Destructor Documentation
|
Default constructor.
Definition at line 19 of file StackA.cpp. |
Member Function Documentation
bool Stack::isEmpty |
( |
|
) |
const |
|
|
Determines whether this stack is empty. - Precondition:
- None.
- Postcondition:
- None.
- Returns:
- True if this stack is empty; otherwise returns false.
Definition at line 23 of file StackA.cpp.
References top.
Referenced by pop(). |
|
Adds an item to the top of this stack. - Precondition:
- newItem is the item to be added.
- Postcondition:
- If the insertion is successful, newItem is on the top of this stack.
- Parameters:
-
| newItem | The given StackItemType. |
- Exceptions:
-
Definition at line 28 of file StackA.cpp.
References MAX_STACK.
Referenced by main(). |
|
Removes the top of this stack. - Precondition:
- None.
- Postcondition:
- If this stack is not empty, the item that was added most recently is removed. However, if this stack is empty, deletion is impossible.
- Exceptions:
-
Definition at line 40 of file StackA.cpp.
References isEmpty(), and top. |
|
Retrieves and removes the top of this stack. - Precondition:
- None.
- Postcondition:
- If this stack is not empty, stackTop contains the item that was added most recently and the item is removed. However, if this stack is empty, deletion is impossible and stackTop is unchanged.
- Exceptions:
-
Definition at line 48 of file StackA.cpp. |
|
Retrieves the top of this stack. - Precondition:
- None.
- Postcondition:
- If this stack is not empty, stackTop contains the item that was added most recently. However, if this stack is empty, the operation fails and stackTop is unchanged. This stack is unchanged.
- Exceptions:
-
Definition at line 59 of file StackA.cpp. |
Member Data Documentation
|
Array of stack items
Definition at line 78 of file StackA.h. |
The documentation for this class was generated from the following files:
|