Overloading binary operators
You overload a binary unary operator with either a nonstatic member functionthat has one parameter, or a nonmember function that has two parameters. Supposea binary operator@ is called with the statement t @ u, where t is an object of type T, and u isan object of type U. A nonstatic member function that overloadsthis operator would have the following form:
return_type operator@(T)
A nonmember function that overloads the same operator wouldhave the following form:
return_type operator@(T, U)
An overloaded binary operator may return any type.
The following example overloads the * operator: