Overloading Binary Operators

From Appmethod Topics
Jump to: navigation, search

Go Up to Overloading Operator Functions Overview Index

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