| << §1.5.(d) Prohibition of name clashes | ↑ Table of Contents ↑ | §1.5.(f) Qualified tsuper >> |
§1.5.(e) Precedence among different supers
If a role inherits the same feature from several super roles (super and tsuper), an implicitly inherited version always overrides any explicitly inherited feature, i.e., a role with the same simple name is closer related than one with a different name.
Also implicit inheritance alone may produce several candidate methods inherited by a role class.
This is a result of team-nesting where each level of nesting may add one more tsuper role
if outer teams also participate in an inheritance relationship.
In this case a role inherited from an implicit super team of the enclosing team
is closer related than a role inherited from an explicit super team.
If necessary this rule is applied inside out until a nesting level is found where indeed
explicit team inheritance is involved.
So when comparing classes by their fully qualified names
the longest common suffix will determine the closest relationship.
E.g., SuperOuter.RoleAndTeamSub.InnerRole
is the closest ancestor of SubOuter.RoleAndTeamSub.InnerRole
because both share the name suffix RoleAndTeamSub.InnerRole.
| << §1.5.(d) Prohibition of name clashes | ↑ Table of Contents ↑ | §1.5.(f) Qualified tsuper >> |
In the above example (Listing 1.5) role
OuterTeam.RoleAndTeamSub.InnerRolehas two direct tsuper roles:OuterTeam.RoleAndTeam.InnerRoleandSuperOuter.RoleAndTeamSub.InnerRole. Without the methodfoodefined in lines 27-30, the enclosing classOuterTeam.RoleAndTeamSub.InnerRolewould inherit the methodfoodefined inSuperOuter.RoleAndTeamSub.InnerRole(line 9), because the common name suffixRoleAndTeamSub.InnerRolecreates a stronger relationship making that class the closest ancestor.