A problem about tiebreaker rule in inheritance
cyberbaixing
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
to E?
> That is exactly the error you would get when trying "B f".Actually,
the
> tiebreaker rule doesn't even come into play here. Now if the
expression
> was just "f" inside a method in either C or D executing as a result
of
> sending a message to B (still with me? ;-) *then* the tiebreaker
rule
> 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
Best Regards,
Xing
More information about the Self-interest
mailing list