C++ Multiple Inheritance Explained

  c++

Email

#include<iostream>

using namespace std;

class Father{
public :
int hight;
void setfather(){

cout << “this is the father coding class”;

}

};
class Mother{
public :
string color;
void setmohter()
{
cout << “this mother coding class”;
}
};

class Chlid : public Father, public Mother{
public :

void setfather(){
cout << “this main of the father vlaues”;
}

void setmohter()
{
cout << “this mohter codjg of “;
}

void setcolorhight(int ihight,string icolor)
{
hight=ihight;
color = icolor;

}

void display()
{

cout << hight << color;
}

};

int main()
{

Chlid anil;
anil.setcolorhight(4,”thuwnd”);
anil.display();
anil.setfather();
anil.setmohter();

}

Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of