0

Can anyone explain me

why c# not supporting multiple inheritance since c++ supporting multiple inheritance ? how it is possible ? How c++ supports ?

muthukumarm
  • 207
  • 4
  • 14
  • Because multiple inheritance is dirty : http://en.wikipedia.org/wiki/Multiple_inheritance#Criticisms – Jay Feb 18 '10 at 04:12
  • 2
    Can you explain what feature of multiple inheritance you are looking for in C#, and maybe we can recommend something else that will achieve your goals? – Dan Feb 18 '10 at 04:13
  • 5
    Ten questions, zero accepted? When you get a best answer to a question, it would be courteous to select that as your accepted answer. It's a nice way of saying "thank you" to the people who take time to read and reply to your question. – Bob Kaufman Feb 18 '10 at 04:33

2 Answers2

3

First, a small correction: C# does support multiple interface inheritance. It doesn't support multiple implementation inheritance.

The two big reasons MI isn't supported are:

  • Chances are good that you can do what you want with multiple interface inheritance anyway.

  • It adds a lot of complexity to the compiler implementation.

IMO, in many cases, the availability of multiple inheritance in a language causes that feature to be frequently abused. Single inheritance already gets wedged into a lot of class hierarchies unnecessarily when something like composition would do just as well.

John Feminella
  • 294,055
  • 44
  • 333
  • 353
0

From an MSDN blog on C# frequently asked questions you can find this answer. There is also this highly rated Stack Overflow question.

Community
  • 1
  • 1
Pace
  • 38,293
  • 12
  • 111
  • 142