【发布时间】:2012-08-18 16:48:56
【问题描述】:
由于此错误,我正在尝试重载 + 运算符:
tools.cpp(147) : error C2679: binary '+' : no operator found which 采用“CSchemaString”类型的右手操作数(或者没有 可接受的转换)
代码是:
// I TRIED THIS TO OVERLOAD + OPERATOR
CSchemaString operator +(const CVisuComm& CVisuComm::TabCCUImess,
const CSchemaString& GetPriority);
//THE CODE AT WHICH THE ERROR IS RETURNED,
//error C2679: binary '+' : no operator found which takes
//a right-hand operand of type
//'CSchemaString' (or there is no acceptable conversion)
CVisuComm::TabCCUImess[CVisuComm::nbCCUImess++]=
"RECONFIGURATION SOLUTION N° " +config.GetPriority();
//THE VARIOUS TYPES ARE
//CVisuComm-------class CVisuComm
//TabCCUImess-----static CString
//nbCCUImess------static int nbCCUImess
//config----------CConfig_State_ChangeType
//GetPriority-----CSchemaString
但它会与
一起引发相同的错误错误 C2751: 'CVisuComm::TabCCUImess' : 函数名 参数不能限定
所以请提出正确的方法来重载运算符。任何帮助表示赞赏。
【问题讨论】:
-
请编辑您的问题以改进格式和组织。
标签: c++ visual-studio visual-c++ visual-c++-2005