class template ?
I am going to quote from C++ primer plus. If someone can please explain in simpler terms that would be great
template <class Type>
bool Stack<Type>::pop(Type & item)
if (top > 0)
Stack<char *> st;
First, the reference variable item has to refer to an Lvalue of some sort, not an array name. Second, the code assumes that you can assign to item. Even if item could refer to an array, you can't assign to an array name. So this approach fails, too.
I'm not quite sure what you're question is so some more info would be great if you want help.
That pop function looks kinda strange as well, I would normally expect to see something like this:
template< class T >
T Stack< T >::pop( )
if (stack not empty)
remove top item and return its value;
The T Stack< T >::pop removes the top element and sets the Type &item to reference it. Method returns false if the top element does not exist, true otherwise.
This can be called like this:
cout<<"Stack is empty"<<endl;