Guest User

Untitled

a guest
Sep 11th, 2011
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.61 KB | None | 0 0
  1. //Files originally from the book files, I have modified it for the assignment
  2. //Header file: stackADT.h
  3.  
  4. #ifndef H_StackADT
  5. #define H_StackADT
  6.  
  7. template <class Type>
  8. class stackADT
  9. {
  10. public:
  11.     virtual void initializeStack() = 0;
  12.        //Method to initialize the stack to an empty state.
  13.        //Postcondition: Stack is empty
  14.  
  15.     virtual bool isEmptyStack() const = 0;
  16.       //Function to determine whether the stack is empty.
  17.       //Postcondition: Returns true if the stack is empty,
  18.       //               otherwise returns false.
  19.  
  20.     virtual bool isFullStack() const = 0;
  21.       //Function to determine whether the stack is full.
  22.       //Postcondition: Returns true if the stack is full,
  23.       //               otherwise returns false.
  24.  
  25.     virtual void push(const Type& newItem) = 0;
  26.       //Function to add newItem to the stack.
  27.       //Precondition: The stack exists and is not full.
  28.       //Postcondition: The stack is changed and newItem
  29.       //               is added to the top of the stack.
  30.  
  31.     virtual Type top() const = 0;
  32.       //Function to return the top element of the stack.
  33.       //Precondition: The stack exists and is not empty.
  34.       //Postcondition: If the stack is empty, the program
  35.       //               terminates; otherwise, the top element
  36.       //               of the stack is returned.
  37.  
  38.     virtual void pop() = 0;
  39.       //Function to remove the top element of the stack.
  40.       //Precondition: The stack exists and is not empty.
  41.       //Postcondition: The stack is changed and the top
  42.       //               element is removed from the stack.
  43. };
  44.        
  45. #endif
Advertisement
Add Comment
Please, Sign In to add comment