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

Will finally block get executed if the exception had not occurred?

2 Answers  


Define boxing and unboxing in c#?

0 Answers  


What do you understand by an Implicit Variable?

0 Answers   CGI,


What is a type c#?

0 Answers  


How do you create multiple inheritance in C#?

5 Answers   Infosys, KenIndia, Microsoft,






Hai I am Shiva from TN, SSE.I have an query problem. My Table : Door Field : ID,DoorID,ZoneID,Date,Time,Status. Problem was : Status.We got two values, one is 00 (OUTTIME) , Another is 01(INTIME) Like this Status --------- 00 01 00 01 00 01 00 01 How to Set as Status 00 and 01 , of separate column , Status as Intime,Status as Outtime Like this ----------- InTime OutTime ---------- ----------- 01 00 01 00 01 00 01 00 01 00 01 00 Regards KS kumar

1 Answers  


How do I format a string in c#?

0 Answers  


What is xpath in c#?

0 Answers  


What is writeline in c#?

0 Answers  


What is before string in c#?

0 Answers  


Explain data types in c#?

0 Answers  


What is architecture of your poroject? how i c an say?

2 Answers   Eminosoft, HCL, Phoenix Technologies,


Categories