Created
November 14, 2018 10:09
-
-
Save mattumotu/a220f870ca81ed1f3b32e37f6bd6be33 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
// Generic example | |
public void myMethod(myDelegate paramName) { ... } | |
// encapsulate matchingMethod1 in myDelegate and pass into myMethod | |
myMethod(new myDelegate(matchingMethod1)); | |
// alternative syntax for matchingMethod2 | |
myMethod(matchingMethod2); | |
// Concrete example | |
public void borrowStapler(responseBehaviour lateResponse) { ... } | |
// encapsulate askPolitely in responseBehaviour delegate and pass into borrowStapler | |
borrowStapler(new responseBehaviour(askPolitely)); | |
// alternative syntax for theLastStraw | |
borrowStapler(theLastStraw); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment