I am building a stack class on top of my list class. I can't do it to save my life. Here is my list class, so can someone show me how to combine the two. And also, what is the point of doing so, if I can't access my list methods from the stack objects?
class stack
{
public:
// Typedefs and member constants
typedef size_t size_type;
typedefchar value_type;
staticconst size_type CAPACITY = 1000;
// Constructors
stack(); // Starts a new empty stack}
stack(stack& stackToCopy); // Copies a stack when declaring new stack
// Modification member functions
void push(const value_type& entry);
void pop();
// Constant member functions
value_type top() const; // Returns top value in array
size_type size() const; // Returns size of array
bool is_empty() const; // Checks to see if array is empty
private:
list myStack; // Partially filled array
};
From here, what do I do? How do I use both in a program?