An abstract class is a class that cannot be instantiated. They are generally meant to be extended/subclasses and generally have "abstract methods" that must be implement by subclasses.

What is an abstract class?

The exact definition varies depending on the language, but generally an abstract class:

  • Cannot be directly instantiated
  • Is meant to be subclassed
  • Can define abstract methods, which must be implemented in subclasses.

Abstract classes in different programming languages

Java

An abstract class is usually used as a base class for a class hierarchy, where subclasses need to define custom behavior for certain methods.

See:

C++

Abstract classes (also called interfaces) are made by defining at least one pure virtual function. The subclasses are required to override the pure virtual functions.

See:

Tag usage

Use this for questions about how abstract classes are related to software engineering. Do not use this for general programming questions.