gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 00:33:37 25 4
gpt4 key购买 nike

我有一个从另一个类扩展的父类(super class)

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 不起作用。我认为它会在类层次结构中搜索它。

最佳答案

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

关于java - 如何调用类层次结构中的方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8387170/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com