Skip to content

Instantly share code, notes, and snippets.

@KucherenkoIhor
Last active September 18, 2017 20:13
Show Gist options
  • Save KucherenkoIhor/1fcacaf5932266dd76ae4e5d731d3ceb to your computer and use it in GitHub Desktop.
Save KucherenkoIhor/1fcacaf5932266dd76ae4e5d731d3ceb to your computer and use it in GitHub Desktop.
class View {
void show() {
print("View.show()");
}
}
class Screen {
private View view; // delegation link
public Screen(View view) {
this.view = view;
}
void show() {
view.show();
}
}
View view = new View();
Screen screen = new Screen(view); // establish delegation between two objects
screen.show(); //View.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment