Friday, June 22, 2012

Why C# does not support multiple inheritance?

Yesterday, One of my friends, Dharmendra ask me why C# does not support multiple inheritance. This is the question most of the people ask every time. So I thought it will be good to write a blog post about it. So why it does not support multiple inheritance?

I tried to dig into the problem and I have found the some of good links from C# team from Microsoft for why it’s not supported in it. Following is a link for it.

Also, I was giving some of the example to my friend Dharmendra where multiple inheritance can be a problem.The problem is called the diamond problem. Let me explain a bit. If you have class that is inherited from the more then one classes and If two classes have same signature function then for child class object, It is impossible to call specific parent class method.

Here is the link that explains more about diamond problem.

Now of some of people could ask me then why its supporting same implementation with the interfaces. But for interface you can call that method explicitly that this is the method for the first interface and this the method for second interface. This is not possible with multiple inheritance. Following is a example how we can implement the multiple interface to a class and call the explicit method for particular interface.

Multiple Inheritance in C#

That’s it. Hope you like it. Stay tuned for more update..Till then happy programming.

Shout it

kick it on


  1. Мне понравилось! Также отличные статьи написаны здесь -

  2. I liked it! Also excellent articles written here -

  3. When someone asks about multiple inheritance, you'd better ask: "Why do you need it? Can you give an example of a problem that cannot be solved without it?" I think it's likely you won't get a convincing response. Especially because object oriented programming taught us to favor object composition over inheritance.

  4. Cristi Lupaşcu - Yes correct and we can do all things with interlace 

  5. Ilya Malinskyy - Thanks but its in Russian and I don't know that.


Your feedback is very important to me. Please provide your feedback via putting comments.

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog


My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews