Explain Inheritance with example in easy way ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Explain Inheritance with example in easy way ?

16th Oct 2017, 9:47 AM
Prashant Kumar
Prashant Kumar - avatar
3 Answers
+ 7
In java classes can be derived from classes. Basically if you need to create a new class and here is already a class that has some of the code you require, then it is possible to derive your new class from the already existing code. This concept allows you to reuse the fields and methods of the existing class with out having to rewrite the code in a new class. In this scenario the existing class is called the super class and the derived class is called the subclass.
16th Oct 2017, 10:49 AM
Pritish
Pritish - avatar
+ 5
inheritance means deriving properties of on class to another. we can reuse the properties of parent class in child class.
16th Oct 2017, 10:49 AM
Pritish
Pritish - avatar
+ 2
Inheritance is the property of oops in which one class uses the property of another class
19th Oct 2017, 11:44 AM
Vandy Sharma
Vandy Sharma - avatar