有一个Day类,其中包含用于保存数据的成员。
我有一个包含Day对象数组的RedBlackTree类。
Day m_list[MAX_LIST];
上面的代码会导致此错误:
错误3错误C2679:二进制'=':找不到运算符,它采用'const Month'类型的右手操作数(或者没有可接受的转换)c:\ program files \ microsoft visual studio 8 \ vc \包括\ xutility 2949
int m_list[MAX_LIST];
当我用Day代替整数时,我没有得到错误。我在课堂上缺少什么。 我有这个operator =
const Day & Day::operator=(Day &otherDay)
{
if(this != &otherDay) // avoid self copy
Copy(otherDay);
return *this;
}
答案 0 :(得分:1)
抱怨Day
错过了operator=
,其中const Month&
类型的参数为<{1}}。
xutility
标头是Visual Studio提供的标准库实现的内部标头。看看2949的功能是什么,这将指向你的问题方向。