MBCS Chapter2. Analysis Question sets 4-6. Fish. Notice the line Implements Locatable In the definition for Fish class. Fish accessor methods. Id Environment Color Location Direction isInEnv toString. isInEnv. Tests Is the fish in this environment? At the expected location?
Analysis Question sets 4-6
Notice the line
In the definition for Fish class
return (environment().objectAt(location()) == this);
this = the current object
Meaning = is this fish recognized by the environment to be at the location where it thinks it is?
Think about it!
…. But wait, there are more…..