TIME是一个类,我定义了缺省构造函数了和拷贝构造函数了,可vc6.0怎么还报错呀:
e:\program files\microsoft visual studio\vc98\include\xutility(39) : error C2679: binary = : no operator defined which takes a right-hand operand of type const class TIME (or there is no acceptable conversion)
e:\program files\microsoft visual studio\vc98\include\vector(170) : see reference to function template instantiation void __cdecl std::fill(class TIME *,class TIME *,const class TIME &) being compiled
这是什么意思啊?
vector < TIME > vec;
好像只要
vec.push_back(t);
就报错
TIME& TIME::operator = (TIME &rhs )
改成 operator = (const TIME & rhs)试试
你的代码不全,我没有试
operator=(TIME&) 改为 operator=(const TIME&), copy ctor 和operator==同样处理
int year() 改成 int year() const, month, day等函数同样处理