Created
January 26, 2018 12:23
-
-
Save manstis/1f8be2874f3aa0ec0e6ce7e757a20e38 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| interface Command { | |
| void execute(); | |
| } | |
| interface DrawLineCommand extends Command { } | |
| interface DrawBoxCommand extends Command { } | |
| Command drawALine() { | |
| return ()->doLineDrawing(); | |
| } | |
| Command drawABox() { | |
| return ()->doBoxDrawing(); | |
| } | |
| I want to return an instance of DrawLineCommand from drawALine and DrawBoxCommand from drawABox | |
| Obviusly I can not use lamdas, and just do new DrawLineCommand() { void execute() {...}}; etc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would do it this way: