Inheritance

Inheritance is the ability of an entity to inherit features and behavior of another entity but in OOP programming the entity is a class. This is very easy to understand by using an example of a human being .The son of a man inherits some of his behavior as well as features like height, colour etc and then his son will also have some of the features of his personality. In the same way in OOP a class can inherit the properties of the base class or father class. This is basically done to minimize coding and complexity .a class can have some properties of base class and other properties can be added by the programmer as required by the logic or aim of the program or specifically it implements reusability of code. Inheritance models the real worlds very efficiently and to a vey great extend proves OOP’s efficiency over other approaches. Subclass is the class which inherits the properties of the base class.

Transitivity of inheritance “if class A inherits properties of class B than all subclasses of A will inherit properties of class B”

Make a Free Website with Yola.