Why .net do not support multiple inheritance

The reason is multiple inheritance arise Diamond Problem(http://en.wikipedia.org/wiki/Diamond_problem).

The languages like C++, support multiple inheritance as this language address the diamond problem using virtual inheritance.

But .NET was designed to support multiple languages, but not all languages can effectively support multiple inheritance.

If .NET needs to support multiple inheritance, then

All languages supported by .NET should support multiple inheritance, which will add the complexity in language semantics (complex syntax and keywords).

Newly introduced make some of these languages more difficult to use because of less similar to their previous version and will not have backward compatibility.

Different languages actually have different expectations for how multiple inheritance works and few languages do not want this concept at all. And expressing them in a language-neutral manner is one more big challenge.
Apart from diamond problem, multiple inheritance injects a lot of complexity in implementing casting, layout, dispatch, field access, serialization, identity comparisons, verifiability, reflection, generics, and probably lots of other places.

Above factors influenced the .NET team to favor not implementing multiple inheritance.

 

admin

Back to top