Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Main {
- public var one:Int = 1;
- public function new() {
- var some = new Some(this);
- trace(some[0]);
- trace(some[1]);
- }
- public static function main() new Main();
- }
- class Some implements ArrayAccess<Int> {
- public var main:Main;
- public function new(m:Main) { main = m; }
- @:arrayAccess public function arrayAccess(k:Int):Int {
- return k == 1 ? main.one : -1;
- }
- @:arrayAccess public function arrayWrite(k:Int, v:Int):Int {
- return k == 1 ? main.one = v : v;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement