Suppose that the minutes
instance variable
lies in the private part of the Attraction
class's definition.
Then, access to that variable
is possible only via methods defined in the Attraction
class:
*------------------------------------------------------------* | Everywhere else | *------------------------ | ---------------------------------* | ^ *-* *------------------------------------------------------------* | *--------------------------------* *-------------------* | | | *-------------* | | | | | | | Same | | | | | | | | class | | | | | | | | | | | | | | | | Rest of the | v | | | Other compilation | | | | compilation --*| minutes | |*--- unit, same package| | | | unit || | || | | | | | <-*| | |*->| | | | | *-------------* | | | | | *--------------------------------* *-------------------* | *------------------------------------------------------------* *-* | v *------------------------ | ---------------------------------* | *---------------------- | -------------------------------* | | | *----------- | -------* | | | | | Subclass in another | | | | | | compilation unit in | | | | | | another package | | | | | *---------------------* | | | *--------------------------------------------------------* | *------------------------------------------------------------*