RAD Studio |  |

Overloading Operator Functions
See Also
Collapse All

Operator functions can be called directly, although they are usually invoked indirectly by the use of the overload operator:

Copy Code

    c3 = c1.operator + (c2);   // same as c3 = c1 + c2

Apart from new and delete, which have their own rules, an operator function must either be a nonstatic member function or have at least one argument of class type. The operator functions =, ( ), [ ] and -> must be nonstatic member functions.

Enumerations can have overloaded operators. However, the operator functions =, ( ), [ ], and -> cannot be overloaded for enumerations.

See Also

Example Of Overloading Operators

Overloaded Operators And Inheritance

Overloading Binary Operators

Overloading The Assignment Operator =

Overloading The Class Member Access Operators ->

Overloading The Function Call Operator ( )

Overloading The Subscript Operator []

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!