Which of the following operator(s) cannot be overloaded?

2017

Which of the following operator(s) cannot be overloaded?

Answer: D. All of the aboveConceptC++ permits operator functions only for its designated overloadable operators. Operators whose syntax controls member selection, name qualification, or…

  1. A.

    . (Member Access or Dot operator)

  2. B.

    ?: (Ternary or Conditional Operator)

  3. C.

    :: (Scope Resolution Operator)

  4. D.

    All of the above

Attempted by 330 students.

Show answer & explanation

Correct answer: D

Concept

C++ permits operator functions only for its designated overloadable operators. Operators whose syntax controls member selection, name qualification, or conditional expression structure retain language-defined behavior so parsing and lookup remain unambiguous.

Application

Apply that rule to each listed operator:

  • The member-access operator . performs built-in member selection and is not overloadable.

  • The conditional operator ?: has language-defined three-operand control syntax and is not overloadable.

  • The scope-resolution operator :: performs compile-time name qualification and is not overloadable.

Cross-check

Each individual operator listed is in the non-overloadable set. Therefore, the set-referential choice “All of the above” is the result.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Rssb Senior Computer Instructor

Loading lesson…