|
|
|
|
|
by throwaway744678
1911 days ago
|
|
In C++, quoting cppreference.com: "Binary operators are typically implemented as non-members to maintain symmetry (for example, when adding a complex number and an integer, if operator+ is a member function of the complex type, then only complex+integer would compile, and not integer+complex)". This makes perfect sense. In other languages, I'd say: perhaps implement the operator in the return type of the operation? |
|