#include #include #include "LeakyStack.h" #include "LeakyStackA.h" using namespace std; /** * Constructor with specified max capacity * \param the maximum capacity (default: 10) */ LeakyStackA::LeakyStackA(int cap) { // ... } /** * Return the number of objects in the stack. * \return number of elements */ int LeakyStackA::size() const { return -1; // Replace this as needed } /** * Determine if the stack is currently empty. * \return true if empty, false otherwise. */ bool LeakyStackA::empty() const { return true; // Replace this as needed } /** * Return a const reference to the top object in the stack. * \return const reference to top element * \throw runtime_error if the stack is empty */ const string& LeakyStackA::top() const { // These lines are NOT correct, but they compile... string junk; // declares a local variable return junk; // returns reference to this local variable (a sure mistake!) } /** * Insert an object at the top of the stack. If the stack * is already at capacity, the oldest element will be lost. * \param the new element */ void LeakyStackA::push(const string& e) { // ... } /** * Remove the top object from the stack. * \throw runtime_error if the stack is empty. */ void LeakyStackA::pop() { // ... }