Created
January 30, 2019 14:56
-
-
Save elizarov/76531f8cf21aebdc00d4a5a0bda8e610 to your computer and use it in GitHub Desktop.
Больше ада
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package a; | |
public abstract class A { | |
abstract void foo(); | |
public void callFooA() { | |
System.out.print("callFooA: "); | |
foo(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package b; | |
import a.A; | |
public abstract class B extends A { | |
void foo() { | |
System.out.println("B.foo()"); | |
} | |
public void callFooB() { | |
System.out.print("callFooB: "); | |
foo(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package a; | |
import b.B; | |
public class C extends B { | |
void foo() { | |
System.out.println("C.foo()"); | |
} | |
public void callFooC() { | |
System.out.print("callFooC: "); | |
foo(); | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package b; | |
import a.C; | |
public class D extends C { | |
void foo() { | |
System.out.println("D.foo()"); | |
} | |
void callFooD() { | |
System.out.print("callFooD: "); | |
foo(); | |
} | |
public static void main(String[] args) { | |
D d = new D(); | |
d.foo(); | |
d.callFooA(); | |
d.callFooB(); | |
d.callFooC(); | |
d.callFooD(); | |
} | |
} | |
/* | |
Produces: | |
D.foo() | |
callFooA: D.foo() | |
callFooB: D.foo() | |
callFooC: C.foo() | |
callFooD: D.foo() | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment