c# - Why can't static classes have non-static methods and variables? -
why can't static classes have non-static methods , variables when non-static classes can have static methods , variables?
what advantage of having static methods , variables in non static class? though having static constructor in non-static class understandable.
static classes can't instantiated in first place, if declare non-static (instance) members, can never accessed. since there isn't point allowing reason, language prohibits it.
bear in mind static classes just classes, while there 2 things directly related non-static classes: the classes themselves, , the instances/objects of classes.
a non-static class can have both static , non-static members static members apply class, whereas non-static members apply instances of class.
Comments
Post a Comment