2
如果我为Foo类写了一个运算符==(用C++),究竟发生了什么?它是否将每个数据成员相互比较?比较两个对象时会发生什么?
class Foo
{
private:
int bar;
public:
bool operator==(const Foo other&)
{
return *this == other; //what?
//is this the same as bar == bar?
}
}
哦,好的,这是有道理的。感谢您的解释! – jkeys 2009-07-29 00:09:27