OOPortal 





Operator Overloading  «Prev  Next»
Lesson 3 Types of operators that can be overloaded
Objective Identify the operators that can be overloaded.
Almost all operators can be overloaded, including:
  1. All the arithmetic, logical, comparison, equality, assignment, and bit operators. In addition, the autoincrement and autodecrement operators (++ and --) can have distinct prefix and postfix meanings.
  2. The subscript or index operator [] and the function call ().
  3. The class pointer operator (->) and the member pointer selector operator (->*).
  4. The operators new and delete.

The assignment, function call, subscripting, and class pointer operators can be overloaded only by nonstatic member functions.

Exceptions
The following operators cannot be overloaded:
  1. the member operator (.)
  2. the member object selector operator (.*)
  3. the ternary conditional expression operator (?:)
  4. the sizeof operator
  5. the scope resolution operator (::)
Operator Overloading - Quiz
Click the Quiz link below to take a brief multiple-choice quiz on which operator can be overloaded.
Operator Overloading Quiz