whats the syntax for overloading the = operator?
Printable View
whats the syntax for overloading the = operator?
is the usual way. The last statement should beCode:class Something
{
Something& operator = (const argtype &arg);
};
return *this;
This way you can do
Something o1, o2, o3;
o1 = o2 = o3 = 234;
You can define as many different = operators as you want, as long as they can be distinguished by the compiler.
thanks