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
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