Operator Overloading:
Chapter 8:
Ms. Munazza Mah Jabeen
Assistant Professor of Computer Science
Overloading Unary Operators:
The term operator overloading
refers to giving the normal C++
operators, such as +, *, <=, and
+=, additional meanings when
they are applied to user-defined
data types: a = b + c;
Overloading Binary Operators (+,<):
Overloading Arithmetic Assignment Operator:
The Subscript Operator ([]):
Data Conversion:
Conversions Between Objects of Different Classes:
UML Class Diagrams:
• Attributes
• Operations
• Association
• Navigability
• Pitfalls of Operator Overloading and Conversion
• Use Similar Meanings
• Show Restraint
• Avoid Ambiguity
• Not All Operators Can Be Overloaded
• Keywords explicit and mutable
• Preventing Conversions with explicit
• Changing const Object Data Using
mutable

Operator Overloading