Why multiple Inheritence is not used in C#?

Answers were Sorted based on User's Feedback



Why multiple Inheritence is not used in C#?..

Answer / naveen mishra

We can implement multiple Inheritence using interfaces

Is This Answer Correct ?    15 Yes 3 No

Why multiple Inheritence is not used in C#?..

Answer / prashant b

because of the name collision of the class

Is This Answer Correct ?    4 Yes 1 No

Why multiple Inheritence is not used in C#?..

Answer / swapnil

to avoid ambiguity problems

Is This Answer Correct ?    3 Yes 0 No

Why multiple Inheritence is not used in C#?..

Answer / a b

Implementing from multiple interfaces is not true multiple
inheritance. The objective of inheritance is code reuse,
which is attained only when the base class contains that
code. But since an interface does not contain any code code
at all, there's no code reuse happening at all. Instead, an
implementing class needs to provide code for each and every
method defined in a class.

Is This Answer Correct ?    3 Yes 0 No

Why multiple Inheritence is not used in C#?..

Answer / a b

Sorry just a correction in 5 above, please read the last
line as 'Instead, an implementing class needs to provide
code for each and every method defined in an interface.'

Is This Answer Correct ?    3 Yes 0 No

Why multiple Inheritence is not used in C#?..

Answer / mayur teli

There is the classic diamond problem encountered in multiple inheritance, in which class D inherits from both B and C, which both inherit from A.

A
/ \
B C
\ /
D
So which copy of A does D get? The one from B, the one from C? Both? This way various languages resolve this problems is discussed here:

http://en.wikipedia.org/wiki/Diamond_problem

Is This Answer Correct ?    3 Yes 0 No

Why multiple Inheritence is not used in C#?..

Answer / ashwi ni chavan

A
/ \
B C
\ /
D
here D get the 2 copy's of A first copy get from B then
second copy get from C .
In class D name collision problem occure means two method's
or data member has same name occure in D class.thats why get
confusion of that's method's this promblem is also called as
Diamond problem........this problem solved using the
interface concept .

Is This Answer Correct ?    0 Yes 0 No

Why multiple Inheritence is not used in C#?..

Answer / rajat

No, you cannot

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More C Sharp Interview Questions

One start and stop button is there and one textbox is there.when you click start button ,it will display 1,2,3......up to infinite in textbox.when you click stop button it will stop.

1 Answers  


What is lazy t?

0 Answers  


What is asp net c#?

0 Answers  


What is keywords in c#?

0 Answers  


Is it good to use var in c#?

0 Answers  






What is difference between "as" and "is" keyword?

1 Answers  


List the two important objects of ado.net and also list the namespaces that are commonly used in ado.net to aid in connection to a database.

0 Answers  


Is string a primitive data type in c#?

0 Answers  


What happens during the process of boxing?

0 Answers  


What are generations and how are they used by the garbage collector?

0 Answers  


Define an abstract class?

0 Answers  


Can dictionary have duplicate keys c#?

0 Answers  


Categories