World w = new World(400, 400);
public class World {
private int width;
private int height;
public World(int width, int height) {
this.width = width;
this.height = height;
}
// A bunch of other stuff
}
Turtle yertle = new Turtle(50, 75, w);
public class Turtle {
private int x;
private int y;
private World world;
public Turtle(int x, int y, World world) {
this.x = x;
this.y = y;
this.world = world;
}
// A bunch of methods
}
Turtle myrtle = new Turtle(200, 300, w);
Turtle nobody = null;
World w = new World(400, 400);
Turtle yertle = new Turtle(50, 75, w);
Turtle myrtle = new Turtle(200, 300, w);
Turtle nobody = null;