Another interesting application of inheritance is to use is as a support to a hierarchical design of a class program. Many programming problems can be cast into a hierarchy where certain features of one level are shared by many others.
![Hierarchical Inheritance Hierarchical Inheritance](https://i2.wp.com/mjginfologs.com/wp-content/uploads/2020/10/image-13-edited.png?resize=359%2C202&ssl=1)
Syntax:
Class BaseA
{
//body
}
Class DerivedB:public BaseA
{
//body
}
Class DerivedC:public BaseA
{
//body
}
Class Derived:public BaseA
{
//body
}
You must log in to post a comment.