#include #include #include #include "BoundedStackB.h" using namespace std; /** * Constructor with specified max capacity * (parameter is optional, so this also serves as default constructor) */ BoundedStackB::BoundedStackB(int cap) { // ... } /** * Returns number of objects in the history. */ int BoundedStackB::size() const { return -1; // Replace this as needed } /** * Returns true if the history is empty, false otherwise. */ bool BoundedStackB::isEmpty() const { return true; // Replace this as needed } /** * Returns reference to the top object in the history. * Throws BoundedStackEmptyException if the history is empty. */ string& BoundedStackB::top() throw(BoundedStackEmptyException) { // 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!) } /** * Inserts an object at the top of the history. */ void BoundedStackB::push(const string& elem) { // ... } /** * Removes and returns the top object from the history. * Throws BoundedStackEmptyException if the history is empty. */ string BoundedStackB::pop() throw(BoundedStackEmptyException) { // 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!) } /** * Destructor */ BoundedStackB::~BoundedStackB() { // ... }