For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
The following table shows a list of operators that can be overloaded.
|<=||Less than or equal to|
|>=||Greater than or equal to|
||||Bitwise inclusive OR|
|Bitwise inclusive OR/assignment|
To declare a binary operator function as a nonstatic member, you must declare it in the form:
where ret-type is the return type,
op is one of the operators listed in the preceding table, and
arg is an argument of any type.
To declare a binary operator function as a global function, you must declare it in the form:
where ret-type and
op are as described for member operator functions and
arg2 are arguments. At least one of the arguments must be of class type.
There is no restriction on the return types of the binary operators; however, most user-defined binary operators return either a class type or a reference to a class type.