SUMMARY
- “operator” is a C++ keyword. It is used in operator functions. It defines a new (overloaded) action for the operator.
Syntax:operator <operator> ( <parameters>){ lt;statements>}
- “Operator overloading” is a principle where a given operator can perform various actions depending on the nature of operands.
- The following operators cannot be overloaded:
- Direct component selector (.),
- C++ dereference (.*),
- Scope resolution operator (::) ,
- Conditional operator (?:)
- The pre-processor symbols # and ## cannot be overloaded.
- We cannot write friend functions to overload following operators:
- Function call ()
- Array subscript []
- C++ indirect component selector ->
- Simple assignment =
- We cannot change the arity (i.e. number of operands associated ...
Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.