【C++ 】 编译不通 求改错!
const int maxstack=30;int count;
enum Error_code{overflow,success,underflow};
enum Error_code outcome;
template<class T,int maxstack> class Stack
{
public:
Stack(); //constructor
bool empty() const;
bool full() const;
Error_code pop();
Error_code top(T &item) const;
Error_code push(const T &item);
private:
int count;
T entry[maxstack];
T item;
};
//以下为Stack类定义
template<class T,int maxstack> void class Stack<T,maxstack>::Stack() //constructor
{count=0;}
template<class T,int maxstack> bool class Stack<T,maxstack>::empty() const
{
bool outcome=true;
if(count>0)outcome=false;
return outcome;
}
template<class T,int maxstack> bool class Stack<T,maxstack>::full() const
{
bool outcome=false;
if(count=maxstack-1) outcome=true;
return outcome;
}
template<class T,int maxstack> Error_code class Stack<T,maxstack>::pop()
{
Error_code outcome=success;
if(count=0)
outcome=underflow;
else --count;
return outcome;
}
template<class T,int maxstack> Error_code class Stack<T,maxstack>::top(T &item)const //取操作数栈顶元素item
{
Error_code outcome=success;
if(count=0)
outcome=underflow;
else item=entry[count-1];
return outcome;
}
template<class T,int maxstack> Error_code class Stack<T,maxstack>::push(const T &item) //将数据item压入操作数栈中
{
Error_code outcome=success;
if(count>=maxtrack)
outcome=overflow;
else entry[count++]=item;
return outcome;
}
请问这个有什么错误?
怎么改。。。