DEV Community

loading...
Cover image for Inheritance Concept

Inheritance Concept

Amritanshu Dev Rawat
New Gen Developer
・1 min read
  • 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

Discussion (6)

Collapse
chinmayghule profile image
Chinmay Ghule

Seriously?

Collapse
amritanshu profile image
Amritanshu Dev Rawat Author

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 Author

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 Author

Yes :)