Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

abstract class

Definition: Abstract Base Class (ABC)

Educative Answers Team

If you were to build a simple door, you would need a guide to follow. This guide may require you to include a handle and a hinge. The advantage of having this guide is that it helps you to not forget to include these two features in your implementation. This is how you should think about an Abstract Base Class (ABC).

svg viewer

In code, what this means is that an abstract class includes at least one abstract method. Generally, an abstract method is one that has a declaration, but not an implementation. In this context, an implementation is the body of the function and consists of one or more lines of code that define the logic of the function. A declaration is generally a single line of code that features the name of the function and may include information on the input and return type of the function.

You are required to provide this implementation in your child class.

You can not instantiate an abstract class on its own as it’s exclusively used ​as a base or parent class.

Abstract base classes can be particularly useful when working in large teams.


abstract class
Copyright ©2022 Educative, Inc. All rights reserved

View all Courses

Keep Exploring