Operator Functions

Operator functions for a class can be invoked implicitly or explicitly. For example, suppose that myFraction and yourFraction are instances of a class that defines operator+. You can display the sum of those two objects using expression syntax:

>? myFraction + yourFraction

You can also use the functional notation to call an operator function:

>? myFraction.operator+( yourFraction )

If an operator function is defined as a friend, you can call it implicitly using the same syntax as for a member function, or you can invoke it explicitly, as follows:

>? operator+( myFraction, yourFraction )

Note that operator functions, like ordinary functions, cannot be called with arguments that require a conversion involving the construction of an object.