| 70 | // Push an object onto the stack |
| 71 | template <typename T> |
| 72 | void Stack<T>::push(const T& item) |
| 73 | { |
| 74 | Node* node{ new Node{item} }; // Create the new node |
| 75 | node->m_next = m_head; // Point to the old top node |
| 76 | m_head = node; // Make the new node the top |
| 77 | } |
| 78 | |
| 79 | // Pop an object off the stack |
| 80 | template <typename T> |