Created
October 3, 2012 11:35
-
-
Save kaja47/3826509 to your computer and use it in GitHub Desktop.
Reflection or not?
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
| class A { | |
| def callThis = println("YOU MANIACS! YOU BLEW IT UP! OH, DAMN YOU! GODDAMN YOU ALL TO HELL!") | |
| } | |
| val a = new A | |
| a.getClass.getMethod("callThis").invoke(a) // reflection | |
| a.asInstanceOf[{ def callThis }].callThis // duck-typed reflection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment