Inheritance is the property which allows a Child class to inherit some properties from its parent class.
In Java this is achieved by using extends keyword.
Only properties with access modifier public and protected can be accessed in child class.
The two most common reasons to use inheritance are:
To promote code reuse
To use polymorphism
No comments:
Post a Comment