1. Home
  2. Computer Science MCQs
  3. C++ and Object-Oriented Programming
  4. Which of these operators cannot be overloaded in C++?

Added 30 Nov -0001

Which of these operators cannot be overloaded in C++?

  1. operator++ and operator--, in prefix or postfix form, cannot be overloaded
  2. The conditional operator ?: together with ::, . (member access), .* and sizeof Correct answer
  3. operator[] and operator(), although both are member functions with arguments and return values
  4. operator new and operator delete, in either their throwing or their non-throwing forms

Correct answer

B. The conditional operator ?: together with ::, . (member access), .* and sizeof

16 views

MCQSEXAM

Explanation

Non-overloadable operators are those whose meaning depends on built-in types or on name lookup: ::, ., .*, ?:, sizeof, typeid and the cast operators. Their exclusion stops programs from redefining fundamental language semantics such as member access. Everything else, including new, delete, the function call operator and the comma operator, may be overloaded when an operand is a class or enumeration type.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C++ and Object-Oriented Programming MCQs

Practise all C++ and Object-Oriented Programming MCQs

Similar MCQs