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