Multitiple inheritance is not possible in C#, however it can be simulated using interfaces, see Simulated Multiple Inheritance Pattern for C#.
The basic idea is to define an interface for the members on class B
that you wish to access (call it IB
), and then have C
inherit from A
and implement IB
by internally storing an instance of B
, for example:
class C : A, IB
{
private B _b = new B();
// IB members
public void SomeMethod()
{
_b.SomeMethod();
}
}
There are also a couple of other alternaitve patterns explained on that page.