SHOW:
|
|
- or go back to the newest paste.
| 1 | - | |
| 1 | + | |
| 2 | {
| |
| 3 | public static function main() | |
| 4 | {
| |
| 5 | var a = new Test(); | |
| 6 | var b = new Test(); | |
| 7 | b.test();//works as expected :Cannot access to private field test | |
| 8 | - | a.checkTest(b); |
| 8 | + | |
| 9 | a.check(b); | |
| 10 | - | var c = new Foo(); |
| 10 | + | |
| 11 | - | a.checkFoo(c); |
| 11 | + | |
| 12 | class Test | |
| 13 | {
| |
| 14 | public function new() | |
| 15 | {
| |
| 16 | } | |
| 17 | public function check(b:Test):Void | |
| 18 | {
| |
| 19 | - | public function checkTest(p:Test):Void |
| 19 | + | b.test();//does NOT work as expected: b suddenly has access to private field test |
| 20 | } | |
| 21 | - | p.test();//t should not have access to private function test |
| 21 | + | |
| 22 | {
| |
| 23 | - | public function checkFoo(p:Foo):Void |
| 23 | + | |
| 24 | } | |
| 25 | - | p.test();//works as expected :Cannot access to private field test |
| 25 | + |