As I read in books and in the web, in C++ we can overload the \"plus\" or \"minus\" operators with these prototypes (as member functions of a class Money
):
Because operator+
and operator-
don't act on this object, but return a new object that is the summation (or subtraction) of this object from another.
operator=
is different because it's actually assigning something to this object.
operator+=
and operator-=
would act on this object, and are a closer analog to operator=
.