views:

46

answers:

2

Can anyone explain me

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

A: 

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

Pace
+2  A: 

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
"Inheritence is overused". I which C# classes would be `sealed` by default, you'd have to explicitly enable inheritance via `base`.
Dan