Overloading Binary Operators
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
- Binary Operators Summary (C++)
- Example Of Overloading Operators
- Overloaded Operators And Inheritance
- Overloading Operator Functions
- Overloading The Assignment operator = (C++)
- Overloading The Class Member Access Operators ->
- Overloading The Function Call Operator ( )
- Overloading The Subscript Operator