Last active
September 18, 2017 20:13
-
-
Save KucherenkoIhor/1fcacaf5932266dd76ae4e5d731d3ceb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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