Wednesday, 18 November 2015

Inheritense



Inheritense is related with the concept of reusavbility. We alwayse feel good when we reuse somwthing.
In inheritence the class can share thew properties of another class withought  rewriting the same codeor properties.
Ex :- Let us take an instance of automobile class.It contains attributes like engine, tyures, fuel, seats, chasies, etc. Now these can be instance of other classes car, bike having the properties engine, fueal seets with some extra properties , but the properties of automobile class will be used in these classes withoughht rewriting  them again in these  class .
There are five types of inheriternce :-
1 single inheritence .
2 Multi level inheritence .
3 Multiple i9nhertitence .
4 Herarchical inheritence .
5 Hybride inheritence.

Derived class can be acces only protected and publick properties of base class as publically , protectly, privatly

No comments:

Post a Comment