When declaring a binary operator, there must be at least one of the operand types. This sounds like a good design decision overall. However, I did not expect the following code to cause this error:
public class Exp<T> { public static Exp<int> operator +(Exp<int> first, Exp<int> second) { return null; } }
What is the problem with this operator? Why does this case fall into C # operator overloading? Is it dangerous to allow such a declaration?
source share