Advertisement
stupidjellyfish

Untitled

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