Which statement about operator overloading in C++ is correct?
Correct answer
C. At least one operand must be a user-defined type
13 views
C. At least one operand must be a user-defined type
13 views
An overloaded operator is only a function whose name is spelled with an operator keyword, and the language requires at least one operand to be a class or enumeration type so that the built-in types keep their meaning. Precedence, associativity and arity are fixed by the grammar and cannot be altered, and only existing operators may be overloaded. The choice of function is made at compile time by ordinary overload resolution.
Asked in: NTS, PPSC IT, Campus Interviews
Not sure why the answer is C? Ask here and get an explanation.