Silver_Smoulder

StackInterface.h(textbook)

Apr 10th, 2019
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. /** @file StackInterface.h */
  2. #ifndef _STACK_INTERFACE
  3. #define _STACK_INTERFACE
  4. template<class ItemType>
  5. class StackInterface
  6. {
  7. public:
  8. /** Sees whether this stack is empty.
  9. @return True if the stack is empty, or false if not. */
  10. virtual bool isEmpty() const = 0;
  11. /** Adds a new entry to the top of this stack.
  12. @post If the operation was successful, newEntry is at the top of the stack.
  13. @param newEntry The object to be added as a new entry.
  14. @return True if the addition is successful or false if not. */
  15. virtual bool push(const ItemType& newEntry) = 0;
  16. /** Removes the top of this stack.
  17. @post If the operation was successful, the top of the stack
  18. has been removed.
  19. @return True if the removal is successful or false if not. */
  20. virtual bool pop() = 0;
  21. /** Returns the top of this stack.
  22. @pre The stack is not empty.
  23. @post The top of the stack has been returned, and
  24. the stack is unchanged.
  25. @return The top of the stack. */
  26. virtual ItemType peek() const = 0;
  27. }; // end StackInterface
  28. #endif
Advertisement
Add Comment
Please, Sign In to add comment