View difference between Paste ID: 04vdknA9 and 8Jec4gg5
SHOW: | | - or go back to the newest paste.
1
class Main
2
{
3
	public static function main()
4
	{
5-
		var a = new Test();
5+
6-
		var b = new Test();
6+
		var t = new Test();
7-
		b.test();//works as expected :Cannot access to private field test
7+
8
		var foo = new Foo();
9-
		a.check(b);
9+
		foo.check(t);
10
		
11
		var test = new Test();
12
		test.check(t);
13
	}
14-
	public function new()
14+
15
16
class Foo
17-
	public function check(b:Test):Void
17+
18
	public function new(){}
19-
		b.test();//does NOT work as expected: b suddenly has access to private field test
19+
20
	public function check(t:Test)
21-
	private function test():Void
21+
22
		t.test();//works as expected :Cannot access to private field test
23-
		trace("hello");
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
33
	}
34
	
35
	private function test(){}
36
}