Even interfaces can have ambiguity problems, if a class implements multiple interfaces which have members of the same name or signature.
In C#, you can get around this with 'explicit interface implementation' where you actually specify the interface name when implementing the member and can only call it using a reference of that interface type. By these means, you can have a different implementation for each interface.
Java does not have this feature and so you can only have a single implementation for all interface members which share the same name or signature.
Multiple inheritance means derive class from multiple classes but java can't extend multiple classes.Java supports multiple inheritance through the use of interface.We can extend one class only to avoid ambiguity problem.In interface we have to define the functions.So we don't get any ambiguity.
VulpesPosted Oct 21, 2011, 2:19 PM
In C#, you can get around this with 'explicit interface implementation' where you actually specify the interface name when implementing the member and can only call it using a reference of that interface type. By these means, you can have a different implementation for each interface.
Java does not have this feature and so you can only have a single implementation for all interface members which share the same name or signature.
Satyapriya NayakPosted Oct 21, 2011, 2:07 PM
Multiple inheritance means derive class from multiple classes but java can't extend multiple classes.Java supports multiple inheritance through the
use of interface.We can extend one class only to avoid ambiguity problem.In interface we have to define the functions.So we don't get any ambiguity.
Thanks
VulpesPosted Oct 21, 2011, 1:45 PM
It was felt that the problems of multiple inheritance (the diamond problem, virtual base classes etc.) outweighed the usefulness of the feature.
However, classes in Java and C# can both implement multiple interfaces instead.