Skip to content

Instantly share code, notes, and snippets.

@martenlienen
Created May 4, 2013 12:16
Show Gist options
  • Save martenlienen/5517330 to your computer and use it in GitHub Desktop.
Save martenlienen/5517330 to your computer and use it in GitHub Desktop.
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
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