Depends.
You could say: not at all, as multiple inheritance does not exist in C#.
You could say: let's use some tricks. Like that:
Interface IA
{
Method A();
}
Interface IB
{
Method B();
}
Then let's add some wrappers which implement the interfaces and just pass thru to the original classes:
class AWrapper : IA
{
A _Instance;
AWrapper()
{
_Instance = new A();
}
Method A ()
{
_Instance.A();
}
}
and similar for B.
Now we can change C:
class C: IA, IB
{
IA _AInstance;
IB _BInstance;
C()
{
_AInstance = new AWrapper();
_BInstance = new BWrapper();
}
Method A()
{
_AInstance.A();
}
Method B()
{
_BInstance.B();
}
}
Well, not exactly inheritance, rather aggregation.