Why multiple inheritance is not supported in C#

Views: 929
Created Date: 27-Sep-2016

C# is very popular and easy to code, because of its simplicity.


So what ever C# developers feel difficult and complicated to understand for programmers, they tried to avoid it. One such kind of property is multiple inheritance.


  • They avoided pointers
  • They avoided multiple inheritance.

Problem with multiple inheritance: Diamond problem.



  • Assume that class A is having a method fun(). class B and class C derives from class A.
  • And both the classes B and C, overrides method fun().
  • Now assume that class D inherits both class B, and C. (just Assumption)
  • Create object for class D.
  • D d = new D();
  • and try to access d.fun(); => will it call class B's fun() or class C's fun()?

This is the ambiguity existing in diamond problem.


It is not impossible to solve this problem, but it creates more confusion and complexities to the programmer while reading it. It causes more problem than it tries to solve.


Note: But any way, implemention of multiple inheritance indirectly possible by using interfaces.

Similar Tags
3.3 3