【发布时间】:2012-03-26 01:05:55
【问题描述】:
我正在重载赋值运算符,并收到此错误。解决不了。
这是模板类 binTree 中的原型
binTree <T>& operator = ( const binTree <T>& ); // assignment operator
方法如下
// assignment operator
template <class T>
void binTree <T>::binTree <T>& operator = ( const binTree <T>& p)
{
if( this != &p )
{
clear(root); // clear tree
root = copy(p.root); // copy tree
}
return *this;
}
我在这一行得到错误
void binTree <T>::binTree <T>& operator = ( const binTree <T>& p)
【问题讨论】:
标签: c++ templates overloading operator-keyword