Why the warning show "Use of undeclared identifier 'Isempty'"and "Use of undeclared identifier 'top'"? It seems to be fail to inherit.
template <class T>
void Stack<T>::Pop(){
if(Isempty()) //warning
throw"Stack is empty.";
top--; //warning
}
The following is class declaration.
#include <iostream>
using namespace::std;
template <class T>
class Bag
{
public:
Bag(int bagcapacity=10);
virtual ~Bag();
virtual int Size()const;
virtual bool Isempty()const;
virtual T& Element()const;
virtual void Push(const T&);
virtual void Pop();
protected:
T *array;
int capacity;
int top;
};
template <class T>
class Stack:public Bag<T>
{
public:
Stack(int stackcapacity=10);
~Stack();
T& Top()const;
void Pop();
};