Chapter 8 Operator Overloading 1. Operator << is used for multiple purposes in C++ -- as the stream-insertion operator and as the left-shift operator. This is an example of operator overloading. 2. C++ enables the programmer to overlod most operators to be sensitive to the context in which they are used. 3. Operator overloading contributes to the C++'s extensibility. 4. To overload an operator, write a function definition; the function name must be the keyword operator followed by the symbol for the operator being overloaded. 5. To use an operator on class objects, that operator must be overloaded -- with two exceptions. The assignment operator (=) may be used with two objects of the same class to perform a default memberwise copy without overloading. The address operator (&) may also be used with objects of any class without overloading; it returns the address of the object in memory. 6. Operator overloading provides the same concise expressions for user-defined types that C++ provides with its rich collection of operators that work on built-in types. 7. It is impossible to change the number of operands an operator takes. The precedence and association of an operator can not be changed by overloading. 8. It is not possible to create new symbols for operators, only the existing operators may be overloaded. 9. When overloading () [] --> or any assignment operator, the operator overloading function must be declared as a class member. 10. Operator functions can be member functions or non-member functions. 11. The array subscript operator [] is not restricted for use only with arrays; it can be used to select elements from other kinds of ordered container classes such as linked lists, strings, dictionaries, and so on. Also, subscripts no longer have to be integers; characters or strings could be used too. 12. Use operator overloading when it makes a program clearer than accomplishing the same operations with explicit function calls. 13. Operator overloading contributes to C++'s extensibility, one of the language's most applealing attributes. 14. It is possible to prevent one class object being assigned to another. This is done by declaring the assignment operator as a private member of the class. 15. By implementing member functions using previously defined member functions, the programmer reuses code to reduce the amount of code that must be written.