Created
May 4, 2013 12:16
-
-
Save martenlienen/5517330 to your computer and use it in GitHub Desktop.
This file contains 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
class X { | |
public int method (X x) { | |
return 0; | |
} | |
} | |
class Y { | |
public int method (Y x) { | |
return 5; | |
} | |
} | |
(new Y()).method(new X()) // gibt 0 zurück |
This file contains 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
class X { | |
public int method (X x) { | |
return 0; | |
} | |
} | |
class Y { | |
//Hier bricht der Compiler ab, weil er erkennt, dass man inkorrekt überschrieben hat | |
@Override | |
public int method (Y x) { | |
return 5; | |
} | |
} | |
(new Y()).method(new X()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment