Pradeep
Why multiple Inheritance not work in C sharp?
By Pradeep in C# on Sep 03 2009
  • Chetnaa Desai
    Aug, 2015 28

    Multiple inheritance is not supported in C# through classes becauseClass P1{public void func1(){.....;}}Class P2{public void func1(){....;}}Class P3:P1,P2{static void Main(){P3 obj=new P3();P3.func1();//Here runtime gets confused whether to call func1() of ClassP1 orP2; Ambuguity}}Hence Multiple inheritance is possible using interfaces

    • 0
  • Sapna Malik
    Sep, 2009 7

    When we use the Multiple inherutance we use more than one class. Lets one condition class A and class B are base classes and class c is is multiple inherting it.And where class c is inheriting a function .It may be possible that this function with same name and same signature can present in both class A and Class B . That time how the compiler will know that which function it should take wherether from class A or class B.So Multiple inheritance show's an error.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS