There are two interfaces B
and C
each having the same method public m1()
class A implements B and C
If class A
has to implement method m1()
, the implemented method would be of which interface?
I think we can say that A.m1 implements both B.m1 and C.m1. Because both
B b = new A();
b.m1();
and
C c = new A();
c.m1();
will work
This is a common problem, this is why having clear instructional method names is important. And good OOP design that will make same methods be abstract.
It is also the reason things are separated out in to classes.
Animal.eat()
Fish extends Animal
Fish.eat()
Dog extends Animal
Dog.eat()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With