如何调用类层次结构中的方法?

发布于 2024-12-19 17:19:48 字数 876 浏览 3 评论 0原文

我有一个从另一个类扩展的超类

public abstract class AbstractDOEMessageFinderAction extends BasicObjectFinder {

    public Object performBasicSearch() {

        // works fine because getQuery is defined in BasicObjectFinder
        return getQuery(); 
    }

另一个类是 ISIRFinderAction ,它扩展自 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();

    }

}

我错过了什么吗?为什么 getQuery 不起作用。我认为它会在类层次结构中搜索它。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

虚拟世界 2024-12-26 17:19:48

第二个类扩展了 AbstractDOEMessageDashboardAction 而不是 AbstractDOEMessageFinderAction

The second class extends AbstractDOEMessageDashboardAction not AbstractDOEMessageFinderAction.

梦在深巷 2024-12-26 17:19:48

AbstractDOEMessageDashboardAction 是否也扩展了 BasicObjectFinder

(请注意,AbstractDOEMessageDashboardAction 当然与 AbstractDOEMessageFinderAction 不同)。

Does AbstractDOEMessageDashboardAction also extend BasicObjectFinder?

(Note, AbstractDOEMessageDashboardAction is ofcourse not the same as AbstractDOEMessageFinderAction).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文