Return by value returns a copy of the object. Return by reference returns the object itself.
Which one you want to use depends on how you want to use the return value. If you want to change it without affecting the original object (after returning), return its value; otherwise, follow the link.
The convention when using the operator = member function is to return by reference. This allows you to chain operations on an object:
CComplexNumber a(1,2); CComplexNumber b(3,4); (a = b) *= 2;
Now, with a return by value after the assignment, *= will not change the value of a , since a copy of of will be scaled to 2. With a return by reference, b will be assigned a , and a will be scaled by 2.
source share