Junior — Middle
Could you list the main types of classes in object-oriented programming?
sobes.tech AI
Answer from AI
In object-oriented programming (OOP), the main types of classes can be distinguished as follows:
- Regular classes — describe objects with state (fields) and behavior (methods).
- Abstract classes — classes that cannot be instantiated directly, used to define a common interface and basic behavior for subclasses.
- Interfaces — define a set of methods without implementation that must be implemented by classes.
- Static classes — contain only static members and cannot be instantiated.
- Sealed classes — classes that cannot be inherited.
- Nested classes — classes declared within other classes, which can be static or non-static.
In C#, these types help organize code and manage inheritance and polymorphism.