Inheritance in Java

Описание к видео Inheritance in Java

In this tutorial we will discuss the real world analogy for inheritance. We will also discuss base and child classes in java.

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
   / @aarvikitchen5572  

What is a Base Class in Java
also called superclass or parent class
What is a Derived Class in Java
also called subclass or child class
What is inherited by derived class
non-private variables, methods etc
properties and behaviour that it can see

Benefits of Inheritance

Keep common code in base class
DRY (Do not repeat yourself) principle
Easy to maintain
Extensibility (adding new implementations)
Keep specialized behavior in derived classes

Note : All java classes inherit from java.lang.Object class implicitly or explicitly

Derived class can hide or override base class members
Abstract method are those methods that are with no body
Abstract class are classes with abstract method
Base class can be abstract or concrete
IS A relationship in java

Note : Abstract base class forces all derived classes to add their own implementations for all abstract methods

Комментарии

Информация по комментариям в разработке