Inheritance
Inheritance
WHAT IS INHERITANCE?
}
// Inherited or Sub Class
class Engineer extends Employee { } OUTPUT
Single Inheritance
Multilevel Inheritance
Hierarchical Inheritance
Multiple Inheritance
Hybrid Inheritance
SINGLE INHERITANCE
In single inheritance, a sub-class is derived
from only one super class. It inherits the properties and
behavior of a single-parent class. Sometimes, it is also known
as simple inheritance. In the below figure, ‘A’ is a parent class
and ‘B’ is a child class. The class ‘B’ inherits all the properties
of the class ‘A’.
MULTILEVEL INHERITANCE
Code Reusability
Abstraction
Polymorphism
DISADVANTAGE
Complexity
Tight Coupling