You must Sign In to post a response.
  • Category: .NET

    Why multiple Inheritance is not possible in C#?

    Hai all,

    C++ can support multiple inheritance than why not c# oR
    Then how it was working fine in C++??
    how interface overcome multiple inheritance ?
    Which reasons they omited multiple inheritance?
  • #742921
    Multiple inheritance is mainly discouraged to avoid the Classic diamond problem which is explained in the following links.

  • #742963
    To avoid the DIAMON issue the multiple inheritance is not allowed in c#.

    In .net multiple inheritance comes with a major issue that is called the Diamond Issue. diamond problem is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If D calls a method defined in A (and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B, or C?





    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #742991

    For ex, in classA you have one method name as "xyz" and in classB also you have a method name as "xyz". When you try to multiple inheritance then CLR gets confused which base class method that is, that's the reason won't support multiple Inheritance.

    Hope this will help you...

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #743011
    In dot net we used multiple interfaces. dot net doesn't support multiple inheritance.

  • #743199
    Hi Srinivasan,

    C# supports single, hierarchical and multilevel inheritance because there is only a single base class.

    C# does not support multiple inheritance directly because there are multiple base classes. We can achieve it using interfaces.

    Gopi A.
    +91 9894315571

  • Sign In to post your comments