The purpose of inheritance is to consolidate and re-use code. For example, if the objects “car,” “truck,” and “motorcycle” are subclasses of vehicle, code applying to all of them can be consolidated into a vehicle superclass . The subclasses inherit this code and any future changes made to it, automatically.
Read moreWhat are the different types of inheritance?
The different types of Inheritance are:
Read more