Back to results for “Match”
C# › Interfaces & Abstract Classes

What is an abstract class, and how does it differ from a fully concrete base class?

Beginner

Answer

An abstract class CANNOT be instantiated directly with 'new' and can contain a mix of concrete (implemented) members AND abstract members (declared but not implemented, requiring subclasses to provide them) — it's meant purely as a base to be extended, unlike a regular concrete class which CAN be instantiated on its own.
public abstract class Animal {
  public string Name { get; set; } = "";
  public abstract void MakeSound(); // must be implemented by subclasses
  public void Sleep() => Console.WriteLine($"{Name} is sleeping."); // shared, concrete implementation
}
// new Animal(); // Error: cannot instantiate an abstract class
Real-world example Defining a shared Animal base class with common behavior (Sleep) plus a required, subclass-specific behavior (MakeSound).

Common follow-ups: Can an abstract class have a constructor, even though it can never be instantiated directly?