C++ Multiple Inheritance Example

Here is a more practical example of multiple inheritances.

//example of multiple inheritance
#include<iostream>
using namespace std;
class person
{
private:
    char name[15], address[15];
public:
    void getdata()
    {
        cout<<"\nEnter Name: ";
        cin>>name;
        cout<<"\nEnter address: ";
        cin>>address;
    }
    void showdata()
    {
        cout<<endl<<"Name: "<<name;
        cout<<endl<<"Address: "<<address;
    }
};

class qualification
{
private:
    char qual[20];
public:
    void getdata()
    {
        cout<<"\nEnter qualification: ";
        cin>>qual;
    }
    void showdata()
    {
        cout<<"\nQualification: "<<qual;
    }
};
class employee:public person, public qualification //can be derived with different access specifier
{
private:
    int empID;
public:
    void getdata()
    {
        person::getdata();
        qualification::getdata();
        cout<<"\nEnter employee ID ";
        cin>>empID;
    }
    void showdata()
    {
        person::showdata();
        qualification::showdata();
        cout<<endl<<"Employee ID: "<<empID;
    }
};
int main()
{
    employee obj;
    obj.getdata();
    obj.showdata();
    return 0;
}

The output of the program is:

multiple inheritance op

C++ Multilevel Inheritance Example
C++ Single Inheritance Example