Constructors in Multiple Inheritance in C++

Constructors in multiple inheritance in C++ programming. In which an object or class can inherit characteristics and features from more than one parent object or parent class.

Multiple Inheritance Calling Functions from Class Function

Program

#include<iostream.h>
#include<conio.h>
class cls
{
public:
void fun()
{
cout<<"This is fun() function of class cls"<<endl;
}
};
class cls2
{
public:
void fun2()
{
cout<<"This is fun2() function of class cls2"<<endl;
}
};
class cls3
{
public:
void fun3()
{
cout<<"This is fun3() function of class cls3"<<endl;
}
}; //class 'cls4' inheriting from class 'cls2, cls3 and cls'.
class cls4: public cls2, public cls3, public cls
{
public:
void fun4()
{
cout<<"This is fun4() function fo class cls4"<<endl;
fun2(); //calling 'fun2()' function.
fun(); //calling 'fun()' function.
fun3(); //calling 'fun3()' function.
}
};
class cls5: public cls4 //class 'cls5' inheriting from class 'cls4'.
{
public:
void fun5()
{
cout<<"This is fun5() function of class cls5"<<endl;
fun4(); //calling 'fun4()' function.
}
};
void main()
{
cls5 obj; //'obj' is object of class 'cls5'.
obj.fun5(); //and calling 'fun5()' function.
getch();
}
Output
This is fun5() function of class cls5
This is fun4() function fo class cls4
This is fun2() function of class cls2
This is fun() function of class cls
This is fun3() function of class cls3

Program Multiple Inheritance Class Default Constructors

Program

#include<iostream.h>
#include<conio.h>
class cls
{
public:
cls()
{
cout<<"This is Default Constructor of Class cls"<<endl;
}
};
class cls2
{
public:
cls2()
{
cout<<"This is Default Constructor of Class cls2"<<endl;
}
};
class cls3
{
public:
cls3()
{
cout<<"This is Default Constructor of Class cls3"<<endl;
}
}; //class 'cls4' inheriting from class 'cls2, cls3 and cls'.
class cls4: public cls2, public cls3, public cls
{
public:
cls4()
{
cout<<"This is Default Constructor of Class cls4"<<endl;
}
}; //class 'cls5' inheriting from class 'cls4'.
class cls5: public cls4
{
public:
cls5()
{
cout<<"This is Default Constructor of Class cls5"<<endl;
}
};
void main()
{
cls5 obj; //'obj' is object of class 'cls5', and automatic
getch();  //calling all classes Default Constructors.
}
Output
This is Default Constructor of Class cls2
This is Default Constructor of Class cls3
This is Default Constructor of Class cls
This is Default Constructor of Class cls4
This is Default Constructor of Class cls5