 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
An
overloaded operator's operands are defined the same as
|
|
|
arguments
are defined for functions.
|
|
| • |
The
arguments represent the operator's operands.
|
|
| • |
Unary
operators have a single argument and binary
|
|
|
operators
have two arguments.
|
|
| • |
When
an operator is used, the operands become the actual
|
|
|
arguments
of the "function call".
|
|
| • |
Therefore,
the formal arguments must match the data
|
|
|
type(s)
expected as operands or a conversion to those types
|
|
must
exist.
|
|
| • |
I
recommend that unary operators always be overloaded as
|
|
|
members,
since the first argument must be an object of a
|
|
|
class (except....as discussed in class)
|
|