Multiple inheritance in Java example -
this question has answer here:
consider following scenario: have 2 interfaces a
, b
. both interfaces have member function display()
.
public interface { public function display() { } } public interface b { public function display() { } } class c implement a, b { public function display{ //definition here } }
i want know
- how many
display()
functions available in classc
? - if there 1 member function, how possible?
a brilliant explanation at: implementing 2 interfaces in class same method. interface method overridden?
if type implements 2 interfaces, , each interface define method has identical signature, in effect there 1 method, , not distinguishable. if, say, 2 methods have conflicting return types, compilation error. general rule of inheritance, method overriding, hiding, , declarations, , applies possible conflicts not between 2 inherited interface methods, interface , super class method, or conflicts due type erasure of generics.
Comments
Post a Comment