A problem about tiebreaker rule in inheritance
cyberbaixing at yahoo.com.cn
Sat Jan 17 23:21:57 UTC 2004
Thanks, Jecel and Gordon:
But I am still puzzled. Why the tiebreaker rule doesn't work here?
Isn't object E sending the message f? Is D right on the path from B
> That is exactly the error you would get when trying "B f".Actually,
> tiebreaker rule doesn't even come into play here. Now if the
> was just "f" inside a method in either C or D executing as a result
> sending a message to B (still with me? ;-) *then* the tiebreaker
> would allow you to choose correctly between C>>f and D>>f.
May I understand your illustration like this?
If C had a method named h which contains f. D doesn't have such a
method. So when I send a message B f, then based on the tiebreaker
rule, C f will be chosed. Is it right? If so, the tiebreaker rule
seems only work between the parents of an object. It doesn't work
among the grandparents of an object. :p
More information about the Self-interest