Possible Duplicate:
Why must C# operator overloads be static?
Why Static keyword before the function signature of all the overloaded operators in C# like:
public static void operator = (Object a, Object b)
When we are doing a = b; then a value will be implicitly passed right. So there is no need of static keyword. It must be like:
public void operator = (Object b)
Is it?
The fact that operators are static allows them to be used in situations where there are null values. It also emphasizes the fact that operators are not applied polymorphically. (They potentially could be applied polymorphically if they weren't static, admittedly... but overriding would generally be a bad idea anyway IMO.)
(Note that you can't overload the assignment operator in C# anyway.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With