我有点困惑,我认为这应该工作。它只是一个父类和一个子类,我无法弄清楚为什么 a) eclipse 抱怨,b) 在实例化对象中没有调用被覆盖的方法。
public class Selector {
private Node rootNode;
private Grid childGrid;
public Selector(){
super();
}
public Selector(Grid childGrid){
this();
this.childGrid = childGrid;
}
public Selector(Node rootNode,Grid childGrid){
this();
this.rootNode = rootNode;
this.childGrid = childGrid;
}
private ArrayList<ArrayList<String>> filter(ArrayList<String> keys){
return null;
}
private ArrayList<ArrayList<String>> innerEneryOrder(ArrayList<ArrayList<String>> children){
return children;
}
private ArrayList<ArrayList<String>> outerEneryOrder(ArrayList<ArrayList<String>> children){
return children;
}}
好的,这是派生类:
public class StandardSelector extends Selector {
@Override
private ArrayList<ArrayList<String>> filter(ArrayList<String> keys){
ArrayList<ArrayList<String>> ret = new ArrayList<>();
for (String s: keys){
ArrayList<String> aL = new ArrayList<String>();
aL.add(s);
ret.add(aL);
}
return ret;
}}
那么,问题出在哪里?