Why we need Inheritance? Because at the starting of programming we dont have any concept like inheritance that time as well we can acheive our goals without using inheritance then why we need inheritance?
Inheritance mainly used for code reuseability. which make method overrides possible.
For example:
Suppose you have made a class which perform some calculation later on you want to use this calculation (and you want some changes in calculations part) so instead of creating object of that class you can inherit and that class.
If you create of object of that class using ABC a = new ABC() like y0u can't override the existing features.so when you want existing feature with minimal changes then inheritance will help you.Also helpful when you want to provide basic features to new classes.
If you create of object of that class using ABC a = new ABC() like y0u can't override the existing features.
so when you want existing feature with minimal changes then inheritance will help you.
Also helpful when you want to provide basic features to new classes.