Which of these operators cannot be overloaded in C++?
Correct answer
B. The conditional operator ?: together with ::, . (member access), .* and sizeof
16 views
B. The conditional operator ?: together with ::, . (member access), .* and sizeof
16 views
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.
Asked in: NTS, PPSC IT, Campus Interviews
Not sure why the answer is B? Ask here and get an explanation.