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

Discussion

To overload an operator................. keyword must be used along with the operator to be overloaded.

  • A.Over
  • B.Overload
  • C.Void
  • D.Operator

Answer: D

The keyword is operator.

An overloaded operator is defined as a function whose name is the keyword operator followed by the symbol being overloaded. For example, Complex operator+(const Complex &other) const; declares how + works for a Complex class, and the compiler then translates a + b into a call to that function.

'Over' and 'Overload' are not C++ keywords at all. void is a keyword, but it names the empty return type and has nothing to do with overloading operators.

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

Post your comment

Please log in or register to post a comment.