 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
If
the first operand is not an object of the class in all
|
|
|
usages: (e.g., + )
|
|
|
|
– |
overload
it as a friend non-member
|
|
|
| • |
As a
non-member, if the operands are not modified by the
|
|
operator
(and are objects of a class)
|
|
|
|
– |
the
arguments should be const references
|
|
|
| • |
If
the first operand is always an object of the class: (+=)
|
|
|
|
– |
overload
it as a member
|
|
|
| • |
As a
member, if the operator does not modify the current
|
|
|
object
(i.e., data members are not modified)
|
|
|
|
– |
overload
it as a const member
|
|