3 ms·
What other languages than C# have the concept of a static class?
by arethuza 13y ago
What other languages than C# have the concept of a static class?
- jimmaswell 13y agoVB.NET for one. It calls them Modules.
- Pxtl 13y agoOther languages can sport a class full of static methods and a private stub constructor, all C# offers is the means to force a class to only contain static methods and block the constructor. You can make an all-static class in any OOP language that supports class-level methods and members. That's my point. This argument is all semantics. There's a million little ways to create something with the functional utility of a Singleton, and there's no sense in pretending that they're vastly different.
- arethuza 13y agoIt was just idle curiosity - I wasn't familiar with the term "static class", looked it up and wondered if that particular set of features (and the term) were used in any other languages.
- Guvante 13y agoNothing special about it, it was just a cheap feature to add (static was already reserved and not previously added before class) while helping to exemplify a common protocol. The one nice thing it does provide is access to defining extension methods, which aren't allowed outside static classes.
- noblethrasher 13y agoIt's just a class that is both sealed and abstract. Therefore, all of its "methods" must be static.
- JonnieCache 13y agoIn ruby, all classes are instances of the Class class. You can put methods on them like any other object. Yeah.
- kodablah 13y agoScala has objects and case objects.