Appendix D ◾ 389
Even with fairly intuitive operations, such as addition, operator over-
loading in C++ may present design challenges. Why? When using tools,
such as compilers, programmers expect consistent use, compatible with
their experience and knowledge. Our initial design did not address implicit
assumptions about the broad use of addition. An experienced program-
mer expects a += b to be supported if a = a + b is supported. Also, if a=
a + 1 is a valid statement, then, for consistency, a++ and ++a should also
be valid. Even if one cannot remember the formal name, commutativity,
one expects that “a + b” yields the same value as “b + a.”
How does one design around the impasse of invoking a class method
through a literal? Recall that ...