Inheritance (C++)

Inheritance lets one class (the derived class) reuse and extend the members of another class (the base class). It models 'is-a' relationships and avoids…