IT terminology – What is an abstract class?

IT terminology – What is an abstract class?

IT terminology

What is an abstract class?

A generic class that is used only as a template for derived classes, and that cannot be instantiated, in object-oriented programming; a class in which no objects can be created. It is, however, used to define subclasses, and objects are created from the subclasses.

In Java programming, a class that contains one or more abstract methods and therefore can never be instantiated. An object cannot be formed from a Java abstract class; trying to instantiate an abstract class only produces a compiler error.

Abstract classes are useful when creating hierarchies of classes that model reality because they make it possible to specify an invariant level of functionality in some methods.

Abstract classes require subclasses to further define attributes necessary for individual instantiation, in contrast to concrete classes, which are the default type. By using abstract classes, you can inherit the implementation of other (non-abstract) methods. You can't do that with interfaces – an interface cannot provide any method implementations.

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics