Copyright © 2024 SingChun Lee Bucknell University. All rights reserved. Sites developed using revealjs.
Class A inherits B, C, and D
Why is this an issue?
Class A inherits B, C, and D
Inheirted fields/methods may have same names but conflicting definitions.
There are five approaches to handle it when designing an object oriented programming language.
Class A inherits B, C, and D // if conflicting, B wins
Class A inherits C, B, and D // if conflicting, C wins
Class A inherits B, C (field x), and D(method foo)
A a = new A(); a(C).x = 4; a(D).foo();
A(B.x, D.foo) a = new A() or A a = new A(B.x, D.foo)