Inheritance explained with real world example in Java

preview_player
Показать описание
In this video, we will see about Inheritance with the real-world example in java,

Inheritance is the way or mechanism by which one class is allowed to inherit the states and behaviors of another class.

We already have a television class we want to build another type of television which has DVD player attached with it. Now for this new class, we want all the variables and the methods of the television class, in addition to that, we need some more methods and variables to support the DVD functionality. To achieve this, we create a class DVDPlayerTelevision by simply extending the television class, In the new class, we can add the variables and methods, supporting the DVD functionality. Now, this newly created class has all the functionality of the television class. Here the Television is the superclass also called as the parent class and DVDPlayerTelevision is the subclass also called a child class.

Links
----------

Рекомендации по теме
Комментарии
Автор

Nice explanation with really good example

nivedithag
Автор

Who are you man and where are you this far days... such a amazing example, hats off man really outstanding example you deserve more likes and views

vimalshanmugam