# Multiple Inheritance
> [NCTU OCW](https://www.youtube.com/watch?v=CRjqXylsmDE&list=PLj6E8qlqmkFtJIl6apB-V_7i1c3eqLjgf&index=9&t=47s)
```
class Boo: public Bum, public Foo
{
}
```
----
sofa bed
''''\ /''''
'' sofabed
```
class Sofa{
public: void sit(){cout<<"sit"<<endl;}
};
class Bed{
public: void lie(){cout<<"lie"<<endl;}
};
class Sofabed:public Soft, public Bed
{
//pass
};
int main()
{
Sofabed myfur;
myfur.sit();
myfur.lie();
return 0;
}
```
*resolution operator(::)界定符號
*Sofa and Bed are parents class(base class)
*Derived class must provide initial arguments for the constructor of each base class
*Format:
```
CDerived::CDerived(arg_B1, arg_B2,...,arg_Bn,arg_Derivrd):
B1(arg_B1), B2(arg_B2),...,Bn(arg_Bn)
{
///
}
```
將初始參數(arg_B1...arg_Bn)傳入派生類別CDerived
*Copy constructors
```
CDerived::CDerived(CDerivrd & c1):
B1(c1), B2(c1),...,Bn(c1)
{
///copy the rest data member
}
```
```
class B1{
int x;
protected : int GetX(){return x;}
public: void SetX(int a=1){x=a;}
};
class B2{
int y;
public: int GetY(){return y;}
void SetY(int a=1){y=a;}
};
class B3{
int z;
public: int GetZ(){return z;}
void SetZ(int a=1){z=a;}
}
class D4 : public B1, public B2, public B3
```