Multiple inheritance in .net

Posted by Nishithraj under Regular Expressions on 2/28/2010 | Views : 3095 | Status : [Member] | Replies : 2
Multiple inheritance is not supported in dotnet. But multiple interface supports. Why this kind of behaviour exists.
Any specific reasons??

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan



Responses

Posted by: Vuyiswamb on: 2/28/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Well there a many reasons to that

.Net allows you to use mutiple languages and all these languages will behave differently or the aproach will be different on multiple inheritance. Even Java Suffered the same fate as .NET languages. but for more info look at this

http://blogs.msdn.com/csharpfaq/archive/2004/03/07/85562.aspx

Thank you for posting at dotnetfunda

Vuyiswa Maseko



Thank you for posting at Dotnetfunda
[Administrator]

Nishithraj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 3/25/2010 [Member] Bronze

Up
0
Down
//Single Inheritance






public class A


{


public A() { }


}





public class B : A





{


public B() { }


}











//Multiple Interface Inheritance





interface IComparable


{


int CompareTo(object obj);


}





interface ISomethingElse


{


int EqualTo();


}











public class Z : IComparable, ISomethingElse


{


public int CompareTo(object obj)


{


// implementation code goes here


}





public int EqualTo()


{


// implementation code goes here


}





}


Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Nishithraj, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response