[Previous] [Contents] [Next]

Summary


Operator overloading and user-defined conversions are useful for creating intuitive interfaces for your classes. When using overloaded operators, keep in mind the associated restrictions while designing your classes. For example, while you can't overload the = assignment operator, when a binary operator is overloaded its compound assignment equivalent is implicitly overloaded. Follow the design guidelines for deciding when to use each feature. Keep the class's client in mind when determining whether or not to overload an operator or set of operators. With a little insight into how your clients would use your classes, you can use these very powerful features to define your classes such that certain operations can be performed with a more natural syntax.

[Previous] [Contents] [Next]