父类中的一个ArrayList:如何创建超(...)
public abstract class Gate implements Logic{
private List<Wire> inputs;
private Wire output;
private String name;
public Gate(String name, List<Wire> ins, Wire out){
}
子类:
public class GateNot extends Gate{
public GateNot(Wire input, Wire output){
super("Not",new ArrayList(input) ,output);//this is apparently incorrect.
}
参数在GateNot的构造是在父类中的参数不同。我想创建一个数组列表并将输入传递给此数组列表,以便超级(...)可以工作。我如何在super(..)中创建这个数组列表?如果一个数组列表在这里不起作用,我可以用这个超级怎么办?
'新的ArrayList(输入)'? –
Constant
可以传递ArrayList而不是List? –
这不起作用.. – user4593157