+ 3
What's the difference between a static class and an abstract class?
So, you can't instantiate an object outta a static class. But isn't that what an abstract class will do?
2 Antworten
+ 9
static indicates the class can only have static members and you cannot create an instance of it. This is used for stateless functionality (for example a type that just defines extension methods, or utility methods). You can also declare a member static on a non-static class. This allows you to attach functionality to a type without having to instantiate it.
abstracts define the basic structure and functionality shared by all derivative types, but cannot be used by themselves. Think of them as, I suppose, a blue print and a contract. This is a core concept for OOP.
Source: http://stackoverflow.com/questions/2390767/whats-the-difference-between-an-abstract-class-and-a-static-one
+ 5
@James Flanders
Thank you for the great explanation!