rules for overloading an operatorthis summarizes


Rules for overloading an operator

This summarizes the most significant points you need to know in order to do operator function overloading.

  • The only operators you may overload are the ones from the C++ list and not all of those are available. You cannot arbitrarily choose a new symbol (such as @) and attempt to "overload it.
  • Start by declaring a function in the normal function fashion, but for the function name use the expression:

                   Operator op

   Where op is the operator to be overloaded. You may leave one or more spaces before op.

  • The pre-defined precedence rules cannot be altered. i.e. you cannot, for instance, make binary '+' have higher precedence than binary '*'. In addition, you cannot alter the associativity of the operators.

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: rules for overloading an operatorthis summarizes
Reference No:- TGS0309398

Expected delivery within 24 Hours