What is an Abstract Class?

Article Details
  • Written By: Kari Wolfe
  • Edited By: Angela B.
  • Last Modified Date: 03 March 2020
  • Copyright Protected:
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Experts think that If the whole world followed a meat-free diet by 2050, it could save over 7 million lives a year.  more...

April 6 ,  1896 :  The first modern Olympic games were held.  more...

In object-oriented programming, an abstract class provides a base class that can be used to provide other classes with partial implementation and interface. They are incomplete by themselves and used in inheritance situations in many programming languages such as Java, C++ and C#. Their usage as a base class means they are often referred to as an abstract base class (ABC).

An integral part of object-oriented programming, data abstraction removes the unnecessary details of an object. Essentially, it boils the object down to its main identifying characteristics. These basic characteristics provide a blueprint that can be used to create other objects with the same properties, only differing in the details.

This blueprint is defined as a class. Classes are used to encapsulate the code, making it easier for the programmer, because he can reference specific common routines instead of writing the routines over and over. Programmers create child objects from classes, and these objects inherit the functions and methods within the parent class.

The purpose of an abstract class is to be the framework upon which other classes are built. Objects cannot be created directly from an abstract class, only from the subclasses belonging to the abstract class. For an object to inherit from an abstract class, a subclass has to be created. Objects of a created subclass of an abstract class inherit properties of that abstract class.


Every class models a concept, and abstract classes tend to model more abstract concepts using abstract methods. Abstract methods are subroutines inside an abstract class that contain no implementation. These subroutines are used as placeholders to be overwritten by a subclass or an object designed based on the class that contains the abstract method itself.

There are different methods of creating an abstract class. For example, in C++, an abstract class is created by developing a class with at least one abstract method or pure virtual function. Java uses a keyword, “abstract,” to denote an abstract class. They are not, however, defined in programming languages that do not support the idea of inheritance.

Inheritance is the process of creating new objects from classes where the new objects can use the functions and methods defined within their parent classes without the need to restate the program. This is why an abstract class is useful. Child classes and child objects of those subclasses inherit properties from the parent abstract class. Abstract classes are considered superclasses and are at the top of the class structure hierarchy, so they have no point in a language that does not support inheritance.


You might also Like


Discuss this Article

Post your comments

Post Anonymously


forgot password?