vijayam
asked on
Selecting interfaces for multiple inheritance
HI!
Why java has selected interface for multiple inheritance..Instead with classes.What's the reason behind selecting interfaces for multiple inheritance.In C++ it has been successfully proved multiple inheritance by useing classes.What's the problem java is facing for not using classes for multiple inheritance.
Thanks & Regards.
Vijaya.
Why java has selected interface for multiple inheritance..Instead with classes.What's the reason behind selecting interfaces for multiple inheritance.In C++ it has been successfully proved multiple inheritance by useing classes.What's the problem java is facing for not using classes for multiple inheritance.
Thanks & Regards.
Vijaya.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
For that ,in c++ they have virtual functions..and dynamycally they might have recognized the method .from which class this method belongs to..
even in java also,they can implement the same procedure..why didn't they followed that one.
Vijaya.
even in java also,they can implement the same procedure..why didn't they followed that one.
Vijaya.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In java it has been deisgned such a way that when you extend u become that object type where as C++ you acquire the object properties.
moreover for the additionkl methods it acquires more characters and properties, and when you can become a only one type of object.
Thanks and Regards
Robert
moreover for the additionkl methods it acquires more characters and properties, and when you can become a only one type of object.
Thanks and Regards
Robert
Yep, from the above
'In the designers' opinion, multiple inheritance causes more problems and confusion than it solves. So they cut multiple inheritance from the language (just as they cut operator overloading). The designers' extensive C++ experience taught them that multiple inheritance just wasn't worth the headache. '
, which is pretty much what i said
'In the designers' opinion, multiple inheritance causes more problems and confusion than it solves. So they cut multiple inheritance from the language (just as they cut operator overloading). The designers' extensive C++ experience taught them that multiple inheritance just wasn't worth the headache. '
, which is pretty much what i said
Yep :-) I wasn't trying to swipe points, I was backing up what had already been said by everyone :-)
Don't accept my comment as an answer :-)
Don't accept my comment as an answer :-)
LOL
public class Child extends Father, Mother
{
public Child()
{
// call parent's method
double walking = walkPace() * 0.3;
}
}
public class Father
{
public int walkPace()
{
return 10;
}
}
public class Mother
{
public int walkPace()
{
return 8;
}
}
In which method does the call to walkPace() in the Child class refer to? How do you distinct? This is the main reason why Java does not support multiple inheritance.