符号重载时的错误。
代码是书上的源码是从官网上下的。应该没问题吧。在visual C++ 6上运行的。
报出了如下错误。'SAMSCalculator::aConsoleOnlyExternalInterface<float>::<<' : overriding virtual function differs from 'SAMSCalculator::anExternalInte
rface<float>::<<' only by return type or calling convention
代码截取: //继承关系
template <class ofType> class aConsoleOnlyExternalInterface: public anExternalInterface<ofType>, public isInstanceCountable
//父类虚方法
virtual anExternalInterface &operator << (const char *theText) const = 0;
//方法重载
aConsoleOnlyExternalInterface &operator << (const char *theText) const;
//方法实现
template <class ofType> aConsoleOnlyExternalInterface<ofType> &aConsoleOnlyExternalInterface<ofType>::operator << (const char *theText) const
{
Display(theText);
return const_cast<aConsoleOnlyExternalInterface<ofType> &>(*this);
};