Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Why .net does not multiple inheritance?

user-image
Question added by AJAM KHAJA SHAIK , process developer , Genpact - India
Date Posted: 2013/10/25
Mohammed Sadique
by Mohammed Sadique , Senior Software Analyst , Alyousuf Exchange and Money Transfers

Multiple inheritance causes problems, if one or more of the parent classes defines members with same identifier. You would have to decide which parent to use to handle each method call, and the operation of class can be then very different than intended.And usually, there is no situations when multiple inheritance is needed. "Good" classes usually maps to some phenomenom or object, and very few things are at the same time  based on two different things. Usually when people wish to do multiple inheritance (is-a), a "has-a" relation is needed, meaning that a class contains some objects.Multiple inheritance is also highly discouraged in languages where it is supported (C++ etc.). Multiple inheritance is confusing at best.

Houssem Gharsallah
by Houssem Gharsallah , Software Architect , NOMD Technologies

To avoid confusion when having attributes or methods whith the same name.

This ambiguity often leads to non-deterministic behavior of classes in multiple inheritance languages. 

You can always use multiple inheritance with interfaces.

More Questions Like This