What are the benefits of inheritance?

 
 

Substitutability, reusability and extensibility.
Substitutability: An object of a properly derived class can be freely and safely substituted for an object of its base class. For example, suppose a user defines a function sample(Base& b). If class Derived properly inherits from class Base, sample(Base& b) will work correctly when an object of class Derived is passed instead of an object of class Base. In contrast, there is no guarantee that sample(Base& b) will work correctly when it is passed an object of a class that was produced by improper inheritance.
Extensibility: The properly derived class can be freely and safely used in place of its base class even if the properly derived class is created months or years after the user code was defined. It's easy to extend a system's functionality when you add properly derived classes that contain enhanced functionality. These guarantees cannot be made when improper inheritance is used.
Reusability: The existing code or functionality can be reused or extended and this improves productivity and test cycles as well.