I have a class Cell
and a class Neighbour
extending Cell
. But I get an error when I try to pass an ArrayList<Neighbour>
to a function expecting an ArrayList<Cell>
. What have I missed?
class Cell {
PVector pos;
Cell(PVector pPos) {
pos = pPos.get();
}
}
class Neighbour extends Cell {
int borders = 0;
Neighbour(PVector pPos) {
super(pPos);
}
}
private int inSet(PVector pPos, ArrayList<Cell> set) {
[...]
return -1;
}
[...]
ArrayList<Neighbour> neighbours = new ArrayList<Neighbour>();
PVector pPos = new PVector(0, 0);
[...]
inSet(pPos, neighbours);
The last line throws the error `The method iniSet(PVector, ArrayList) is not applicable for the arguments (PVector, ArrayList);
Thanks for your help!