c# multiple inheritance
c#, multiple-inheritance
Solution
You do not need multiple inheritance in this particular case: If class `C` inherits only from `B`, any instance of class `C` can be cast to both `B` and `A`; since `B` already derives from `A`, `C` doesn't need to be derived from `A` again:
class A { ... }
class B : A { ... }
class C : B { ... }
...
C c = new C();
B bc = (B)c; // <-- will work just fine without multiple inheritance
A ac = (A)c; // <-- ditto
(As others have already said, if you need something akin to multiple inheritance, use interfaces, since a class can implement as many of those as you want.)
Problem
I would like to achieve this in C# (Pseudocode) ``` class A; class B : A; class C : A, B; ... A ac = (A)c; ... B bc = (B)c; ``` Is this possible?