Sobes.tech
Junior — Middle

Can an abstract class have methods declared as abstract, and how does it affect its usage?

sobes.tech AI

Answer from AI

In C#, an abstract class can contain abstract methods without implementation. These methods are declared with the keyword abstract and do not have a body.

If an abstract class declares an abstract method, then this class cannot be instantiated directly — it only serves as a base for inheritance.

Subclasses that inherit from an abstract class are required to implement all its abstract methods, otherwise they must also be declared abstract.

Thus, the absence of implementation for abstract methods in an abstract class forces inheriting classes to provide a concrete implementation, ensuring a contract and structure for the code.