c# multiple inheritance
问题 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? 回答1: 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