¿¹Á¦

class MyClass {
public:
MyClass& operator=(const MyClass& rhs);

private:
int field;
};


MyClassMyClass::operator=(const MyClass& rightValue)
{
if(rightValue.field == this.field){
return rightValue;
}
}

¼Ö·ç¼Ç
´ëÀÔ ¿¬»êÀÚ¿¡¼­ *this¸¦ ¸®ÅÏÇϽʽÿÀ.

class MyClass {
public:
MyClass& operator=(const MyClass& rhs);

private:
int field;
};


MyClassMyClass::operator=(const MyClass& rightValue)
{
if(rightValue.field == this.field){
return *this;
}
}