0
Why is the ampersand before obj for?
In the following code, why is it OK to add/remove the & before obj? MyClass operator+(MyClass &obj) { MyClass res; res.var= this->var+obj.var; return res; }
3 Respuestas
+ 1
Thanks! So the difference is after we could change obj.var in the function and whether we could see the changed value after function call.