hi every one
suppose i have a Car class
public class Car{
[INDENT]int speed;
int id;
..
public void move(){
....
}[/INDENT]}
and a Race class
public class Race{
[INDENT]int array[][];//contains car ids in race or 0 for none [/INDENT]
[INDENT]Car cars[];
....
public void startRace(){
...
}[/INDENT]
}
if a car wants to move in move() it should know whether there's another car infront of it or behind it.
how can i know in car class if there's another car infront of me or not?
how to implement that?
and thank you