Inheritance
Inheritance is a relation between classes that makes it possible to define and implement a class based on other existing classes.
Also, inheritance helps code reusability and allows independent extensions of the original class (the super class) through public classes and interfaces. The relationship between classes through inheritance causes a hierarchy.
Inheritance inevitably minimizes the amount of rework when we need to add additional information and functionalities to an existing class, as we can use the class as the super class and subclass it to add new state information and behavior.
Moreover, when it is coupled with polymorphisms and dynamic binding, inheritance minimizes the amount of existing code that should be changed ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access