163 subscribers
3.42K photos
24 videos
39 files
371 links
Link: @java_posts

Contact: java.response.email@gmail.com
Download Telegram
What is Inheritance ?
Inheritance is a method in which one object acquires/inherits another object’s properties, and inheritance also supports hierarchical classification. The idea behind this is that we can create new classes built on existing classes, i.e., when you inherit from an existing class, we can reuse methods and fields of the parent class. Inheritance represents the parent-child relationship.
#Explanation
#Inheritance
#OOP_Concepts_java
* Single level
In this one class i.e., the derived class inherits properties from its parental class. This enables code reusability and also adds new features to the code. Example: class b inherits properties from class a.


* Multilevel
This one class is derived from another class which is also derived from another class i.e., this class has more than one parental class, hence it is called multilevel inheritance.
#Source_code
#OOP_Concepts_java
#Inheritance
#114
* Hierarchical level
In this one parental class has two or more derived classes or we can say that two or more child classes have one parental class.

* Hybrid inheritance
This is the combination of multiple and multilevel inheritances and in java, multiple inheritances are not supported as it leads to ambiguity and this type of inheritance can only be achieved through interfaces.
#Source_code
#OOP_Concepts_java
#Inheritance
#115