Created
February 6, 2013 12:41
-
-
Save kaja47/4722309 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
| class A { val l: Long = 47 } | |
| class B { val a: Int = 0; val b: Int = 0; def aa = a; def bb = b } | |
| val a = new A | |
| val b = new B | |
| unsafe.putInt(a, 8, unsafe.getInt(b, 8)) | |
| val a_b = a.asInstanceOf[B] | |
| a_b.getClass // B | |
| a_b.aa // 47 | |
| a_b.bb // 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment