0

What is difference between abstract class and inheritance?

When I was learning abstract class and inheritance i haven't found much difference, the purpose of both seems same, so why there is these 2 different concepts. Edit: There was differences prior to launching of Java 1.8 Where in interface we could have only abstract methods but now interface can have both default methods and abstract methods.

8th Oct 2021, 12:25 AM
Gul Mohammed
Gul Mohammed - avatar
1 Réponse
+ 2
Inheritance: We need to override the method in child class We use Inheritance in case of Parent-Child relationship[Child can have all functionalities which Parent have and can add more functionality to itself too] And we use Abstract class(In java) for a partial set of default implementations of methods in a class, which also can be implemented by simple Inheritance. Abstract class: Put abstract keyword in method name and need to implement the method in child class
22nd May 2022, 3:14 AM
😇🌟SWATI🌟😇
😇🌟SWATI🌟😇 - avatar