Project 2
Stack.hpp
Go to the documentation of this file.
1 //  Adapted from Frank M. Carrano and Timothy M. Henry.
2 
5 #ifndef STACK_HPP
6 #define STACK_HPP
7 
8 #include <stdexcept>
9 #include "Node.hpp"
10 
11 using namespace std;
12 
13 template<class ItemType>
14 class Stack
15 {
16 private:
17  Node<ItemType>* headPtr; // Pointer to first node
18  int currentSize; // Current depth of the stack
19 
20 public:
22  Stack();
25  int size() const;
28  bool isEmpty() const;
33  bool push(const ItemType& newItem);
36  bool pop();
41  ItemType peek() const throw(logic_error);
44  void clear();
46  virtual ~Stack();
47 }; // end Stack
48 
49 #include "Stack.cpp"
50 #endif
51 
Definition: Stack.hpp:14
Definition: Node.hpp:8