§3.4.(d) Private methods from super classes
If a callout binding shall bind to a private base method, that method
must be defined in the exact base class to which the current role
class is bound using playedBy. I.e., for private methods
§3.1.(d) does not hold.
The same holds for private base fields (see below).
If a private base feature must indeed be callout-bound, a role class
must be defined that is played by the exact base class defining the
private feature. Another role bound to a sub-base-class can then
be defined as a sub class of the first role. It will inherit the
callout binding and through this it can access the desired feature.
| 1 |
public class SuperBase { |
| 2 |
private int secret; |
| 3 |
} |
| 4 |
public class SubBase extends SuperBase { } |
| 5 |
public team class MyTeam { |
| 6 |
protected class SuperRole playedBy SuperBase { |
| 7 |
int steal() -> get int secret; |
| 8 |
} |
| 9 |
protected class SubRole extends SuperRole playedBy SubBase { |
| 10 |
int steal() -> get int secret; |
| 11 |
} |
| 12 |
} |