about C#
-
Because it was easier not to, I suspect. You should use interfaces as a poor substitute. Interfaces are cool and useful, but they do not replace multiple inheritence.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
let assume following class class base1{} class base2{} class derive{} :base1,base2 Here if both base class has one common method say Method1().Now,during execution if derived class excess Method1(),then derived class will get confuse :confused: as from which base class i should get Method1(),therefore they were taken out from C# as well as from java.:rose:
Regards Chintan www.visharadsoft.com (Nothing is so purify as KNOWLEDGE)
-
let assume following class class base1{} class base2{} class derive{} :base1,base2 Here if both base class has one common method say Method1().Now,during execution if derived class excess Method1(),then derived class will get confuse :confused: as from which base class i should get Method1(),therefore they were taken out from C# as well as from java.:rose:
Regards Chintan www.visharadsoft.com (Nothing is so purify as KNOWLEDGE)
There also the case where 2 base classes inherit from the same base, you then inherit from those 2 classes.
----- If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
-
Because it was easier not to, I suspect. You should use interfaces as a poor substitute. Interfaces are cool and useful, but they do not replace multiple inheritence.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
I don't know... Stroustrup did it way back in the early 80s. Surely MS in the new millennium should have been able to do it? I think Chintan has the right answer below.
Cheers, Vıkram.
After all is said and done, much is said and little is done.
-
It is VERY easy to abuse multiple inheritance and end up in "M.I. Hell" -- circular references, inheriting methods from each class that have the same name, destructors being called twice because two bases derive from the same base. All of this can be avoided with careful design, but I think it was a case of protecting the programmer from himself (herself). -Phil PS. I thought I'd save some time/code while programming a strategy/card game in C++ by having the card inherit from the actual unit so it could read it's stats and display it -- since the Card interface had the same accessor names for these stats I had to overload everything in the card in order to call the correct "versions" of these functions, and no time was saved.
-
From the C# Frequently Asked Questions: http://blogs.msdn.com/csharpfaq/archive/2004/03/07/85562.aspx[^]
----------------------------- In just two days, tomorrow will be yesterday.
-
let assume following class class base1{} class base2{} class derive{} :base1,base2 Here if both base class has one common method say Method1().Now,during execution if derived class excess Method1(),then derived class will get confuse :confused: as from which base class i should get Method1(),therefore they were taken out from C# as well as from java.:rose:
Regards Chintan www.visharadsoft.com (Nothing is so purify as KNOWLEDGE)
> Here if both base class has one common method say Method1().Now,during execution if derived class excess Method1(),then derived class will get confuse Not really. :-) This problem has already been solved at a same matter with multiple inheritance interfaces. It could be solved (IMHO with more willing). For example:
class base1
{
void Method()
{
DoSomethingGood();
}
}class base2
{
void Method()
{
DoSomethingVeryGood();
}
}class derive : base1, base2
{
new void base1.Method()
{
DoSomethingBad();
}
new void base2.Method()
{
DoSomethingVeryBad();
}
}