Why multiple inheritance is not possible in c#

Answers were Sorted based on User's Feedback



Why multiple inheritance is not possible in c#..

Answer / saurabh

Suppose, you have class A, which implements a method Show().
This class is now Inherited by Class B and Class C.
Now both B,C will have Show available to them or may be they
have overridden the functionality of Show() defined by Class
A. So far this is fine.

Now If I have Class D inheriting from Class B and Class C.
Which Show() method will class D be using? How many
implementations of Show will be available there for class D?
This is the problem.

Is This Answer Correct ?    55 Yes 11 No

Why multiple inheritance is not possible in c#..

Answer / gp_bellamkonda

When we use the Multiple inherutance,we use more than one
class.Suppose class A and class B are base classes and
class c is is multiple inherting it.it may be possible that
this function with same name and same signature can present
in both class A and Class B .At this time how the compiler
will know which function it should take wherether from
class A or class B.
So Multiple inheritance won't work.
To avoid this problem we use Interface..... it means in
interface we just declare a function and in the derived
class we give the definition as per the requirement...means
function should be abstract ... and in interface all funcion
[method] should abstract

Is This Answer Correct ?    36 Yes 6 No

Why multiple inheritance is not possible in c#..

Answer / kanan

There is no definitive answer to this question. It is a
matter of taste.
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?

Is This Answer Correct ?    18 Yes 8 No

Why multiple inheritance is not possible in c#..

Answer / shrikant narayanrao khode

Reason :
Every class inherit ToString() method.

class A ---> ToString()

class B ---> ToString()
-----------------------------
class C :A,B

Toatl ToString() method will be ----> 2
It is going to raise ambiguity problem.
Thats why Multiple inheretance is not possibe.

Is This Answer Correct ?    5 Yes 0 No

Why multiple inheritance is not possible in c#..

Answer / santosh bind

By Diamond Shape problems in C#

Is This Answer Correct ?    0 Yes 0 No

Why multiple inheritance is not possible in c#..

Answer / satya

let me explain clearly,,,, suppose there is a class called
A(base class)and it has a method Print(). now I am
implementing heirarchical inheritance and derived classes
are B, C and D. now in three derived classes that print() is
there. now the problem is form which class (from derived
classes for first class A) i have to take print() ?
If signature is same then no problem, if it differs what is
the result?

Is This Answer Correct ?    0 Yes 1 No

Why multiple inheritance is not possible in c#..

Answer / sravanthi

Deriving a new class from more than 1 base class (or) old
class is called multiple inheritance.but c# does not
supports it.but we can implement multiple concept by using
interfaces.

Is This Answer Correct ?    3 Yes 17 No

Why multiple inheritance is not possible in c#..

Answer / kiran

because in c sharp dot net we implementing the interface
concept so here ..multiple inheritence is not possible so
thats the reason

Is This Answer Correct ?    7 Yes 69 No

Post New Answer

More C Sharp Interview Questions

Define a jagged array in c#?

0 Answers  


ctype(123.34,integer) - should it throw an error? Why or why not?

2 Answers   Wipro,


Explain the difference between abstract class and interface in .net?

0 Answers  


Where is the output of TextWriterTraceListener redirected?

1 Answers  


Define xslt.

0 Answers  






which access modifier we can declare the abstract class?

5 Answers   IBM,


What is void in c#?

0 Answers  


How do I download a program to my desktop?

0 Answers  


Name any three ways to pass parameters to a method in c#?

0 Answers  


What is difference between an reference type and value type in C#?

0 Answers   B-Ways TecnoSoft,


In gridview in editmode if we want to display information in one combobox based on

0 Answers   FD, Microsoft,


What is a value type in c#?

0 Answers  


Categories