I know "implement interface" means: A class implement a interface. Now I met a puzzle in Android Studio (In IntelliJ IDEA, there has a similar doubts.): Note the following picture: When Child implement the Interface, and override the method fun2, there will be a specific icon on the left.But the Parent don't implement the Interface, why an same icon appear?
Bigger picture here
In the full version of IntelliJ with the 3 example classes you posted above, the icon you refer to has hover text:
Implements method in Interface via sub-class Child
In other words IntelliJ is smart enough to see the association between the interface and the inheritance structure.
Why does it do this? Well if you remove the definition of fun1
from Child
class, then fun1
is of course visible in Child
class via inheritance from Parent
, thereby fulfilling the requirement to implement Interface
.
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