Professional Documents
Culture Documents
Operator Overloading
Operator Overloading
Almost any operator can be overloaded in C++. However there are few
operator which can not be overloaded.
scope operator - ::
sizeof
member selector - .
ternary operator - ?:
2. The overloaded operator must have at least one operand that is type of user
defined.
4.The Overloaded operators follows the rules of the original operators. They
cannot be overridden.
9. When using the binary operators overloaded using a member function, the
left hand side operand must be an object of the relevant class.
10. Binary arithmetic operators such as *,+,- and / must be explicitly return
the value, they must not attempt to change their own arguments.