0

My question is why members are not by default static in static class.

As we see, interface members are by default public and abstract.

Thanks, Anil

  • Interface members are indeed public and abstract, that's by definition. You cannot create a private member in an interface. – Stefan Nov 23 '15 at 09:46
  • 1
    [Why can't static classes have non-static methods and variables?](http://stackoverflow.com/questions/7783828/why-cant-static-classes-have-non-static-methods-and-variables) – Tim Schmelter Nov 23 '15 at 09:46

1 Answers1

0

We should ask c# language designer.

But I understand the ratio behind: it forces the programmer to say "this function is static", even if it would be implied by the fact the the class is static.

Maybe It's a matter of readability: when you read a method without body (and no abstract keyword), you know that this method can only be part of an interface. When you read a method without "static" modifier, you would need to read also class declaration to understand that is part of a static class and therefore static itself

Gian Paolo
  • 4,161
  • 4
  • 16
  • 34