inheritance in c++

1. Inheritance gives hierarchical structure of class and subclass in the form of “parent-
child” relationship.

2. For example: the bird “robin” is a part of the class ’flying bird’ which is again a part
of the class ‘bird’. Here class ‘bird’ is called super-class and class ‘flying bird’ is
called sub-class(derived class).



3. In inheritance each derived class shares common characteristics of its super class.

4. Each subclass shares all the attributes of super class and defines only that
features which are unique to it.

5. It provides the idea of reusability. This means that we can add additional features to an existing class without modifying it. This is possible by deriving a new class from existing one.







Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post