Here's a MySpace-object from the World-class Where I declare two Bee's. See the code below.
Which getters and setters should be accesible for which bee?
The reason for my question is that when I do a ctrl+space after dennis, I get access to getName and getOursOfFlying. When I do that do debbie, I only can access the getName. Why is that?
Yours,
Dennis
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class MySpace here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MySpace extends World
{
private Bee dennis;
private Animal debbie;
private Apple thisApple;
public MySpace()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
System.out.println();
// dennis is from class Bee
dennis = new Bee();
dennis.setName("Dennis");
System.out.println(dennis.getName());
dennis.setOursOfFlying(20);
System.out.println(dennis.getOursOfFlying());
// debbie is from class Bee.
debbie = new Bee();
debbie.setName("Debbie");
System.out.println(debbie.getName());
addObject(dennis, 200, 200);
addObject(debbie, 300, 300);
}
}


