 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
To
distinguish the prefix from the postfix forms,
|
|
|
the C++ standard has added an unused
argument
|
|
|
(int)
to represent the postfix signature.
|
|
|
| • |
Since
these operators should modify the current
|
|
|
object,they
should not be const members!
|
|
|
| • |
Prefix:
residual vlaue is an lvalue
|
|
counter
& counter::operator ++ () { .... //body }
|
|
counter
& counter::operator -- () { .... //body }
|
|
|
| • |
Postfix: residual value is an rvalue,
different than
|
|
the
current object!
|
|
counter
counter::operator ++ (int) { .... //body }
|
|
counter
counter::operator -- (int) { .... //body }
|
|