Machine-translated by Google. Questions are authored in English.
Top

Discussion

In C++/C operators such as............ cannot be overloaded.

  • A.+
  • B.+ +
  • C.: :
  • D.= =

Answer: C

The operator that cannot be overloaded is ::, the scope resolution operator.

C++ allows most operators to be given new meanings for user-defined types, but a few are fixed by the language: the scope resolution operator ::, the member access operator ., the pointer-to-member operator .*, the conditional operator ?: and sizeof. These work on names and types at compile time rather than on values, so overloading them would make the language ambiguous.

The other options, +, ++ and ==, are among the operators most commonly overloaded, for example to add, increment or compare objects of a class.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.