Created
March 1, 2015 19:52
-
-
Save momer/84ba224c5f3fbd310b31 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
package myApp; | |
class ImplementsDynamic | |
implements Dynamic<String> { | |
public var present:Int; | |
public function new() {} | |
} |
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 myApp; | |
// import myApp.ImplementsDynamic; | |
class Main { | |
static public function main() { | |
var c = new myApp.ImplementsDynamic(); | |
// valid, present is an existing field | |
c.present = 1; | |
// valid, assigned value is a String | |
c.stringField = "foo"; | |
// error, Int should be String | |
// c.intField = 1; | |
trace(c.stringField); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment