Skip to content

Instantly share code, notes, and snippets.

@sohaibiftikhar
Last active June 25, 2018 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sohaibiftikhar/d2175af74030d34f36252079a7a10dd2 to your computer and use it in GitHub Desktop.
Save sohaibiftikhar/d2175af74030d34f36252079a7a10dd2 to your computer and use it in GitHub Desktop.
java mixins
class A {
public int a() {
return 1;
}
}
class B1 extends A {
public int b() {
return a() + 1;
}
}
class B2 extends A {
public int b() {
return a() + 2;
}
}
interface C {
default int a() {
return 2;
}
}
class B1e extends B1 implements C {
public int a() {
return C.super.a();
}
}
class B2e extends B2 implements C {
public int a() {
return C.super.a();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment