帮忙看看,谢谢了^_^
#define INFIX 0
#define POSTFIX 1
#define OPND 4
#define OPTR 8
template<class type>
class expnode
{
public:
int tent;
union{type opnd;char optr;}
expnode():tent(INFIX),optr('='){}
expnode(type opnd):tent(OPND),opnd(opnd){}
expnode(char optr):tent(OPTR),optr(optr){}
};
编译的时候这个程序段出错,3个构造函数都出错,自己看了半天不会改,谁帮忙看看,谢谢了
Compiling...
Expression.cpp
H:\C++\算法\栈应用(表达式求值)\Expression.cpp(17) : error C2533: 'expnode<type>' : constructors not allowed a return type
H:\C++\算法\栈应用(表达式求值)\Expression.cpp(20) : see reference to class template instantiation 'expnode<type>' being compiled
H:\C++\算法\栈应用(表达式求值)\Expression.cpp(17) : error C2533: 'expnode<type>::expnode<type>' : constructors not allowed a return type
H:\C++\算法\栈应用(表达式求值)\Expression.cpp(20) : see reference to class template instantiation 'expnode<type>' being compiled
Error executing cl.exe.