December 1998
Intermediate to advanced
624 pages
13h 8m
English
Yes, overloaded operators are syntactic sugar for normal functions.
Operator overloading allows existing C++ operators to be redefined so that they work on objects of user defined classes. Overloaded operators are syntactic sugar for equivalent function calls. They form a pleasant facade that doesn't add anything fundamental to the language (but they can improve understandability and reduce maintenance costs).
For example, consider the class Number that supports the member functions add() and mul(). Using named functions (that is, add() and mul()) makes sample() unnecessarily difficult to read, write, and maintain.
The syntax is clearer if operators ...
Read now
Unlock full access