DEV Community

Cover image for Inheritance Concept
Amritanshu Dev Rawat
Amritanshu Dev Rawat

Posted on

Inheritance Concept

  • Like a child inherit many properties and behaviors from parents, the same can be done in programming called Inheritance.

  • Parent class


Parent{
// owns a house
}

Enter fullscreen mode Exit fullscreen mode
  • Child class inherited from the parent class

Child Inherits From Parent{
// automatically get the house as he is a child
// can add own properties and behavior - play basketball, change hair color
}

Enter fullscreen mode Exit fullscreen mode

Top comments (6)

Collapse
 
chinmayghule profile image
Chinmay Ghule

Seriously?

Collapse
 
amritanshu profile image
Amritanshu Dev Rawat

have to add more?

Collapse
 
nawazkings profile image
Ali

A lot more, maybe some real use case examples like inheriting methods to avoid duplication?

Thread Thread
 
amritanshu profile image
Amritanshu Dev Rawat

It was a part of my 1 minute guide, so I want it to be as simple as possible, maybe write a full blog on OOPS.

Thread Thread
 
nawazkings profile image
Ali

oh, okay. Mentioning that in the title would be much helpful, like, "Inheritance Concept explained as simple as possible?"

Thread Thread
 
amritanshu profile image
Amritanshu Dev Rawat

Yes :)