When I start a new scenario, add classes and put objects of that classes in the world, every object automatically gets an object reference to the World. At least that's what I see when I rightclick the object and click 'inspect': I see a 'World world' reference there.
If so, then why do I need to add another object reference to the world when needing something like adding a new object to the world. For example, a Gardener has to add a plant:
if (Greenfoot.isKeyDown("z")) {
World world = getWorld();
world.addObject(new Plant(), getX(), getY());
}
That second line is needed, and I don't understand why, since there is already an objectreference to the world.
When deleting the second line, the error says:
"world is not public in greenfoot.Actor; cannot be accessed from outside package"
Thanks in advance!

