Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 827 Bytes

14.1.md

File metadata and controls

16 lines (10 loc) · 827 Bytes

In what ways does an overloaded operator differ from a built-in operator?

Main difference

  • An overloaded operator can be called directly as normal function, while a built-in operator cannot.
  • Overloaded opereators do not preserve order of evaluation and/or short-circuit evaluation.

Difference about overloaded operator function

  • An overloaded operator function must either be a member of a class or have at least one parameter of class type.
  • Only part of the existing operators can be overloaded. (We cannot invent new operator symbols.)

In what ways are overloaded operators the same as the built-in operators?

  • Overloaded operators can be used as the built-in operators in the same way snytactically.
  • Overloaded operators have the same precedence and associativity as the corresponding built-in operators.