Created
July 29, 2013 07:45
-
-
Save tosik/6102706 to your computer and use it in GitHub Desktop.
valueOf を使わずに Object が int に変換される例
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
| package | |
| { | |
| import flash.display.Sprite; | |
| public class Main extends Sprite | |
| { | |
| public function Main() | |
| { | |
| trace(int(new Foo).valueOf()); //=> 123 | |
| } | |
| } | |
| } | |
| class Foo | |
| { | |
| public function toString():String | |
| { | |
| return "123"; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
int(new Foo) の段階で 123 になる