CSC 2110 Lecture Notes - Lecture 12: Function Prototype, Operator Overloading, Reserved Word
Document Summary
Extends definition of operator to work with a user-defined data type. C++ allows you to extend the definitions of most of the operators to work with classes. Assignment and member selection are the only built in operations of classes. Other operators cannot be applied directly to class objects by default. If both operands of / are integers, the result is an integer; otherwise, the results is a floating-point number. C++ allows the user to overload most of the operators so that the operators can work effectively in a specific application. To overload an operator for a class. You cannot change the precedence of an operator. Cannot change change the number of parameters an operator takes. For objects of the user defined type. For a combination of objects of the user defined type and objects of the built in type. Sometimes, it is necessary for a member function to refer to the object as a whole single unit.