Tuesday 17 November 2015

What is Inheritance ? Give an example of Inheritance

Inheritance: One object properties may acquire other object.
A class that is inherited is called a superclass. The class that does the inheriting is called a subclass.
Inheritance is done by using the keyword extends.

Ex: Class Child extends Parent
Advantages: a. Reusability of code
                     b. Polymorphism
Note: Java does not supports multiple Inheritance

No comments:

Post a Comment