I'm feeling rather stupid - must be missing something silly --- I wanted to subclass the generic STL stack class so that I could extend it with a combined top followed by pop operation but my compiler is telling me that both top and pop are undeclared identifiers.
template <typename T>
class MyStack : public stack<T>
{
public:
T PopTop() // Convenience - combined top and pop in one go
{
T result = top();
pop();
return result;
}
};
I note that I can fix this problem by writing
T result = stack<T>::top();
but why isn't top seen automatically given the stack class is directly inherited?
Thanks in advance