Inheritance
Often asked during interviews: C++ Interview Questions.
Inheritance is the ability of one object to acquire some/all properties of another object. Implementation of the is-a relationship.
A child inherits the traits of his/her parents.
With inheritance, reusability is a major advantage. You can reuse the fields and methods of the existing class.
i.e., inheritance: class A (parent) serves as partial blueprint for class B (child)
- Child class B inherits all fields/methods of parent class A
- Child class B can add new field/methods, and override the definitions of methods inherited from parent class A