Search code examples
c#c++staticoperator-overloadinglanguage-design

Why must C# operator overloads be static?


Why does C# require operator overloads to be static methods rather than member functions (like C++)? (Perhaps more specifically: what was the design motivation for this decision?)


Solution

  • Take a look at this post.

    A couple of reasons, the primary seeming to be to preserve operator symmetry (such that the left hand side of a binary operation does not get special treatment, as being responsible for dispatching the operation).