SHOW:
|
|
- or go back to the newest paste.
| 1 | class Main extends flash.display.Sprite | |
| 2 | {
| |
| 3 | - | public var i:Int; |
| 3 | + | public function new(param:Null<Int>) |
| 4 | {
| |
| 5 | - | public function new(?i:Null<Int>) |
| 5 | + | |
| 6 | ||
| 7 | var a:Int = null; //On static platforms, null can't be used as basic type Int | |
| 8 | - | this.i = i; |
| 8 | + | var b:Int = param; // no warning, results in 0 |
| 9 | } | |
| 10 | ||
| 11 | public static function main() | |
| 12 | {
| |
| 13 | - | trace(new Main(null).i);//0 |
| 13 | + | new Main(null); |
| 14 | } | |
| 15 | } |