What is Inheritance?

Get introduced to inheritance, a powerful concept of Object-Oriented Programming.


Inheritance provides a way to create a new class from an existing class. The new class is a specialized version of the existing class such that it inherits all the non-private fields (variables) and methods of the existing class. The existing class is used as a starting point or as a base to create the new class.

The IS A relationship

After reading the above definition, the next question that comes to your mind is What is the use case of inheritance? Well, the answer is that wherever we come across an IS A relationship between objects, we can use inheritance.

Get hands-on with 1200+ tech skills courses.