Which of the following operators can not be overloaded in C+ + ?

2013

Which of the following operators can not be overloaded in C+ + ?

  1. A.

  2. B.

    + =

  3. C.

    = =

  4. D.

    : :

Attempted by 244 students.

Show answer & explanation

Correct answer: D

Answer: The scope resolution operator (::) cannot be overloaded in C++.

Reason: The scope resolution operator is part of the language's core name and scope resolution mechanism and is handled by the compiler at compile time. Its semantics are fixed by the language and cannot be changed by user-defined operator overloads.

  • * — Can be overloaded. Implement operator* as a member or non-member to define multiplication behavior for user-defined types.

  • += — Can be overloaded. Typically implemented as a member that modifies the left-hand operand; often provided alongside operator+.

  • == — Can be overloaded. Often implemented as a non-member (or friend) to allow symmetric comparisons; pair with operator!= for consistent behavior.

  • :: — Cannot be overloaded. This operator is reserved for compile-time scope and name resolution.

Quick tip: When overloading comparison operators, provide the complementary operators (for example, if you overload ==, also provide !=) to avoid surprising behavior.

Explore the full course: Mppsc Assistant Professor