I’m not a C++ guy, but I’m forced to think about this. Why is multiple inheritance possible in C++, when I’m not able to do it in C#? (I know the diamond problem, but that’s not what I’m asking here). How does C++ distinguish the ambiguity of same method signatures inherited from multiple base classes? And why the same design can’t be incorporated in C#?
Share
This is a question of choice. Anders Hejlsberg, the C# language designer, chose to leave multiple inheritance out of the language. You may wonder why… My guess would be that (1) multiple inheritance is often not needed, (2) multiple inheritance is often used in the wrong way (like so many object-orientation constructs) and (3) it would make the language and/or the compiler and/or static checking unnecessarily complex.
The CLR itself does not prevent multiple inheritance; hence, it is available in C++.NET.