View difference between Paste ID: 8wxKExLn and 04vdknA9
SHOW: | | - or go back to the newest paste.
1
class Main
2
{
3
	public static function main()
4
	{
5
		
6
		var t = new Test();
7
		
8
		var foo = new Foo();
9
		foo.check(t);
10
		
11
		var test = new Test();
12
		test.check(t);
13
	}
14
}
15
16
class Foo
17
{
18
	public function new(){}
19
20
	public function check(t:Test)
21
	{
22
		t.test();//works as expected :Cannot access to private field test
23
	}
24
}
25
26
class Test
27
{
28
	public function new(){}
29
30
	public function check(t:Test)
31
	{
32-
		t.test();//b should not have access to private function test
32+
		t.test();//does NOT work as expected:  should NOT have access to private field test
33
	}
34
	
35
	private function test(){}
36
}