1

Possible Duplicate:
Should C# include multiple inheritance?

One of my friend asked me the question i.e.Why C# doen't support multiple inheritance

Community
  • 1
  • 1
Jibu P C_Adoor
  • 3,254
  • 9
  • 27
  • 36
  • 5
    Lots of questions like this: http://stackoverflow.com/questions/191691/should-c-include-multiple-inheritance – David Neale May 19 '10 at 12:14
  • But why does it should support them? The net value of having multiple inheritance is quite low in comparison with increase of language's complexity. – Regent May 19 '10 at 12:18

3 Answers3

1

Using interfaces is more flexible and eliminates the ambiguity of multiple inheritance.

Further details, HERE.

thelost
  • 6,488
  • 3
  • 26
  • 43
  • 1
    Since interfaces are a subset of multiple inheritance, I'm not sure how you conclude that they are more flexible. – Marcelo Cantos May 19 '10 at 12:16
  • 1
    how can it be more flexible? inheriting from a class is nothing like inheriting from a interface, the interface only defines a contract without actual functionality/code-reuse –  May 19 '10 at 12:17
1

Multiple inheritance complicates the language and its implementation. I suspect the designers decided that the gains weren't worth the pains.

Marcelo Cantos
  • 174,413
  • 38
  • 319
  • 360
1

C#, like Java supports a way to deal with multiple inheritance by allowing a class to implement multiple Interfaces. Its not quite multiple inheritance but it can accomplish what you want to get done.

aarona
  • 33,950
  • 39
  • 126
  • 179
  • 1
    Interestingly, there is a version of Eiffel for .Net that uses CLR interfaces and delegates to implement Eiffel's version if Multiple Inheritance. – Kramii May 19 '10 at 12:23