liveBook · Manning

Abstract class

As explained in .NET in Action, Second Edition

An abstract class is a C# class that may contain incomplete implementations and cannot be instantiated directly.

An abstract class is an incomplete C# implementation that provides a base for derived classes. It cannot be instantiated directly, and derived classes must implement members marked with the abstract keyword. section 2.8

Use abstract classes when a shared base implementation should require specialization:

  • Derive classes from one abstract class and fill in its missing implementations. section 2.8
  • Mark unimplemented methods or properties with abstract. section 2.8
  • Choose interfaces when classes need multiple contracts, because a class can inherit from only one base class but implement multiple interfaces. section 2.8

How .NET in Action, Second Edition covers it

How deep it goes
Defines incomplete implementations and instantiation constraints, but stops short of a worked abstract-class implementation.
What you can do after
Evaluate whether a shared base class or multiple interfaces better fits an object-oriented design.
How it connects
Connects abstract classes with interfaces, inheritance, contracts, and abstract members.

Also explained in

Compare how 6 books explain abstract class →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET in Action, Second Edition. The section links point to the parts of the book it draws on.