is the concept that when a class
of object is defined, any subclass that is defined can inherit the definitions of one or more general classes. This means for the programmer
that an object in a subclass
need not carry its own definition of data and methods that are generic to the class
(or classes) of which it is a part. This not only speeds up program development; it also ensures an inherent validity to the defined subclass object (what works and is consistent about the class will also work for the subclass).
The simple example in C++
is having a class that inherits a data member from its parent
class B : public A
The class B in the example does not have any direct data member does it? Yes, it does. It inherits the data member d from class A. When one class inherits from another, it acquires all of its methods and data. We can then instantiate an object of class B and call into that data member.