Sunday, September 11, 2011

Why is it that a java class implements multiple interfaces but will extend only one class

Reason:
Diamond Problem
In object-oriented programming languages with multiple inheritance and knowledge organization, the diamond problem is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If a method in D calls a method defined in A (and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B, or C?

So in java it is restricted to multiple inheritance through interface 


No comments:

Post a Comment