Created
March 26, 2011 15:44
-
-
Save irof/888387 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 Hello {void hello(){println "1"}} | |
def a = new Hello() | |
def b = new Hello() | |
b.metaClass.hello = { println "2" } | |
a.hello() | |
b.hello() | |
a.metaClass.hello = {b.metaClass.hello} | |
a.hello() | |
b.hello() | |
a.metaClass.hello = { println "3" } | |
a.hello() | |
b.hello() | |
a.&hello() |
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
1 | |
2 | |
2 | |
3 | |
2 | |
1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment