jan_flanders

Untitled

Jul 28th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. class Main
  3. {
  4.     public static function main()
  5.     {
  6.         var a = new Test();
  7.         var b = new Test();
  8.         a.checkTest(b);
  9.        
  10.         var c = new Foo();
  11.         a.checkFoo(c);
  12.     }
  13. }
  14. class Test
  15. {
  16.     public function new()
  17.     {
  18.     }
  19.     public function checkTest(p:Test):Void
  20.     {
  21.         p.test();//t should not have access to private function test
  22.     }
  23.     public function checkFoo(p:Foo):Void
  24.     {
  25.         p.test();//works as expected :Cannot access to private field test
  26.     }
  27.     private function test():Void
  28.     {
  29.         trace("hello");
  30.     }
  31. }
  32. class Foo
  33. {
  34.     public function new()
  35.     {
  36.     }
  37.     private function test():Void
  38.     {
  39.         trace("hello");
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment