1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | class Doggo {
private boolean booped; // other classes may not access this field!
Doggo() {
this.booped = false;
}
public boolean getBooped() {
return this.booped;
}
public void boop(otherDoggo : Doggo) {
this.booped = true;
otherDoggo.booped = true; // this is allowed!
}
}
|