Why multi inheritance is not possible by using c#.net | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Why multi inheritance is not possible by using c#.net

please explain about it

11th Oct 2017, 3:10 PM
santosh kumar
santosh kumar - avatar
4 Answers
+ 7
Well things get complicated if we allow multiple inheritance. If both parent class contain the same member or method signature, which one should have the priority? The hierarchy is non-linear anymore and the usage of base keyword would be confusing. Don't you think this actually makes our life easier? 😉
11th Oct 2017, 3:36 PM
Zephyr Koo
Zephyr Koo - avatar
+ 2
This is not designed in this language.Probably because it is not so clear (i.e. if two class define the member functions or property).Insted of this you can inherite more interface with only one implementation of method.The same approach is designed in Java language.
11th Oct 2017, 3:19 PM
Highman
Highman - avatar
+ 2
@Zephyr exactly!
11th Oct 2017, 3:39 PM
Highman
Highman - avatar
+ 1
I've read that is because of "Name Conflicts". If a class inheritages from 2 classes with a propriety or atribute with same names, it would result an ambiguity. This can be solved, but the developers preffered to forbid it in name of performance. Good studies bro.
16th Oct 2017, 4:26 PM
LF Campos
LF Campos - avatar