How to call a method in a class hierarchy?
-
28-10-2019 - |
Вопрос
I have this super class which extends from another class
public abstract class AbstractDOEMessageFinderAction extends BasicObjectFinder {
public Object performBasicSearch() {
// works fine because getQuery is defined in BasicObjectFinder
return getQuery();
}
The other class is ISIRFinderAction
which extends from AbstractDOEMessageDashboardAction
ISIRFinderAction extends AbstractDOEMessageDashboardAction {
// My aim is to make sure this method works so that I will make
// the super class's performBasicSearch() method abstract.
public Object performBasicSearch() {
// this one doesnt even compile but it extends AbstractDOEMessageDashboardAction
// which in turn extends BasicObjectFinder
return getQuery();
}
}
Am I missing something? Why is getQuery
not working. I thought it would search it in the class hierarchy.
Решение
The second class extends AbstractDOEMessageDashboardAction
not AbstractDOEMessageFinderAction
.
Другие советы
Does AbstractDOEMessageDashboardAction
also extend BasicObjectFinder
?
(Note, AbstractDOEMessageDashboardAction
is ofcourse not the same as AbstractDOEMessageFinderAction
).
Не связан с StackOverflow