Skip to content

Instantly share code, notes, and snippets.

@piatra
Created September 13, 2015 09:41
Show Gist options
  • Select an option

  • Save piatra/298d466b4d92c5497d0d to your computer and use it in GitHub Desktop.

Select an option

Save piatra/298d466b4d92c5497d0d to your computer and use it in GitHub Desktop.
class D {
int method(D x) {
return -1;
}
int method() {
return 0;
}
}
class E extends D {
int method() {
return 1;
}
int method(D x) {
return 2;
}
int method(E x) {
return 3;
}
}
class F extends E {
int fun(D d) {
return d.method();
}
int foo() {
return ((D)this).method((D)this);
}
}
class Apple {
public static void main(String[] args) {
F x = new F();
System.out.println(x.foo());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment