Skip to content

Instantly share code, notes, and snippets.

@laszlovandenhoek
Created December 21, 2017 09:14
Show Gist options
  • Save laszlovandenhoek/504d09e9f88172fdc77189b3ffbf9f36 to your computer and use it in GitHub Desktop.
Save laszlovandenhoek/504d09e9f88172fdc77189b3ffbf9f36 to your computer and use it in GitHub Desktop.
Composition in Java only goes so far :(
abstract class What {
public abstract String foo();
}
interface How {
default String foo() {
return "foo";
}
}
public class Concrete extends What implements How {
//not so fast, Bob:
@Override
public String foo() {
return How.super.foo();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment