03ln-inheritance.md: Diamond Problem: Left, Right and Bottom print the same text
Closed this issue · 1 comments
cboltz commented
In your example for the diamont problem, you have 3 copies of method()
that all println("Right.method()");
If someone runs the example, the output will be
Right.method()
Right.method()
Right.method()
Wouldn't it make more sense if Left
would println("Left.method()");
and Bottom
would println("Bottom.method()");
to make it clear which one generates the output?
I'd also consider to add a similar println("Top.method() - shadowed in Right and Left");
to interface Top
. This will never run because it's always shadowed - but having it might make the shadowing more obvious.
In the end, if someone runs the example, the output should be
Bottom.method()
Left.method()
Right.method()
sikoried commented
Thanks, fixed!