Came across interesting inheritance / overriding issue (taken from here).
When both Base and Derived classes are abstract, and
- both have exactly same abstract method, or
- abstract Base has concrete method, and Derived declares SAME method abstract.
I don't understand why Eclipse IDE calls it in Derived
- implements (it gives NO CODE / BODY in Derived!)
- overrides (also gives NO CODE / BODY in Derived!)
Snippet 1:
public abstract class Girl {
abstract String getDescription();
}
abstract class GirlDecorator extends Girl {
abstract String getDescription(); // implements Girl.getDescription() - says Eclipse IDE
}
Snippet 2:
public abstract class Girl {
String description = "no particular";
String getDescription() {
return description;
}
}
abstract class GirlDecorator extends Girl {
abstract String getDescription(); // overrides Girl.getDescription() - says Eclipse IDE
}