Skip to content

Instantly share code, notes, and snippets.

@RuedigerMoeller
Last active August 29, 2015 14:15
Show Gist options
  • Save RuedigerMoeller/7f31f246b0adb5c80a00 to your computer and use it in GitHub Desktop.
Save RuedigerMoeller/7f31f246b0adb5c80a00 to your computer and use it in GitHub Desktop.
abstract class ByteStream { .. }
class SomeClass {
void someMethod() {
this.getStream().writeByte(13); // call on interface or abstract class
}
ByteStream getStream() { .. }
}
// later in code
// does this avoid dynamic dispatch inside "SomeClass:someMethod" ?
SomeClass clsA = new SomeClass() {
ConcreteByteStream getStream() { .. }
};
SomeClass clsB = new SomeClass() {
OtherConcreteByteStream getStream() { .. }
};
@RuedigerMoeller
Copy link
Author

:-) i will some day, thanks for your statement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment