 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Overloading
operators as non-member functions is like
|
|
|
|
defining
regular C++ functions.
|
|
|
| • |
Since
they are not part of a class' definition, they can only
|
|
|
|
access
the public members. Because of this, non-member
|
|
|
|
overloaded
operators are often declared to be friends of the
|
|
|
class.
|
|
|
| • |
When
we overload operators as non-member functions, all
|
|
|
|
operands
must be explicitly specified as formal arguments.
|
|
|
| • |
For
binary operators, either the first or the second must be
|
|
|
|
an
object of a class; the other operand can be any type.
|
|