Hi,
I have overloaded assignment operator like below and it worked perfectly fine.
void Test::operator = (Test& obj)
{
this->a = obj.a;
this->b = obj.b;
}
But when I googled more about this, I could see all of the examples used a different prototype like this
Test& Test::operator = (Test& obj)
{
//do something on *this
return *this;
}
Is there anything wrong in the first method?