Hybrid Inheritance

Hybrid inheritance is combination of two or more inheritances such as single, multiple, multilevel or Hierarchical inheritances. There could be situations where we need to apply two or more types of  inheritance to design a program.

Hybrid Inheritance
Hybrid Inheritance

Syntax:

Class BaseA   // Base class for Class C
{
       //body
}
Class BaseB : public BaseA
{
     //body
}
Class BaseC
{
     //body
}
Class Derived : public B
aseB,public BaseC
{
    //body
}

Here, Class Derived is inheriting the property of class BaseB and BaseC. Class BaseB inheriting the class BaseA.

Related posts