Hi all,
I read something like "C# does not support multiple inheritance but it supports multilevel inheritance". what could be the reason for this? If it possible to achieve multiple inheritance in C# using some workaround?.
Thank you.
Hi all,
I read something like "C# does not support multiple inheritance but it supports multilevel inheritance". what could be the reason for this? If it possible to achieve multiple inheritance in C# using some workaround?.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajeesh MenothPosted Sep 11, 2015, 12:20 AM
The Diamond problem is an ambiguity that arises when two classes B and C inherit from Class A and class D inherits from both B and C. If a method in D calls a method defined in A(and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B or C?
That is the reason why C# and Java languages does not support multiple inheritance.
Upendra Pratap ShahiPosted Sep 11, 2015, 1:22 AM
What is wrong with multiple inheritance?
The main problem with multiple inheritance is that there can be times when the results of using multiple inheritance will be uncertain. The best example of this is the classic problem known as the diamond problem where a class inherits from 2 different classes, but those 2 different classes inherit from the same class,
Harshad PansuriyaPosted Sep 11, 2015, 12:14 AM