Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Operators can be overloaded to provide more natural syntax for custom types. Operator overloading is most appropriately used for implementing custom structs that represent fairly primitive data types. For example, a custom numeric type is an excellent candidate for operator overloading.
The following symbolic operators can be overloaded:
+ - * / ++ -- ! ~ % & | ^ == != < << >> >
Implicit and explicit conversions can also be overridden (with the
implicit and explicit keywords), as can the literals true and false, and the unary + and -
operators.
The compound assignment operators (e.g., +=, /=) are
automatically overridden when you override the noncompound operators
(e.g., +, /).