Inheritance is one of the most important concept of Object-Oriented Programming. It is one of the building block for programming concepts.
What is Inheritance?
There are 5 points which will define the concept of Inheritanc.e in a simpler way:
- It is based on Generalization Principle.
- It explains about the logical association of Parent class with child class or Base class with Derived class. Child class inherits all the properties of parent calss and uses them.
- Inheritance runs over Open-Close Principle. That means base class is closed for modification whereas derived class is open for modification.
- It tells us how a derived class extends the behavior of base class (loosely coupled), which is Extensibility.
- It is based on Dependency Principle. That is Derived class can access the functionalities of base class, which is the concept of Reusability.