Overloading Binary Operators

From RAD Studio
Jump to: navigation, search

Go Up to Overloading Operator Functions Overview Index (C++)

You can overload a binary operator by declaring a nonstatic member function taking one argument, or by declaring a non-member function (usually friend) taking two arguments.

If @ represents a binary operator, x@y can be interpreted as either x.operator@(y) or operator@(x,y) depending on the declarations made.

If both forms have been declared, standard argument matching is applied to resolve any ambiguity.

See Also