Setting this->var and obj.var
So when I fiddled around with the sample code, I made it print out what this->var and obj.var were set to perform the operation. When main() is written as obj1+obj2, it set this->var to be the number on the left side of the operation and obj.var to be the number on the right side, which is consistent with this->var+obj.var as written in the overloaded operator function. However, upon rewriting the overloaded operator function as read obj.var+this->var, it still set the obj1 as this->var and obj2 as obj.var. Why is this? How are this->var and obj.var set? TL/DR: Basically, for overloading operator, +: res.var= obj.var+this->var; vs. res.var= this->var+obj.var; Yield the same results when printing out this->var and obj.var for obj1+obj2.