Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dtest-039.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1535710bc3e9e0a28634a0ff175aeb79b7cc438b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
class A
{
	public virtual object Foo ()
	{
		return null;
	}
	
	public virtual object[] FooArray ()
	{
		return null;
	}
	
	internal virtual object Prop {
		get {
			return 9;
		}
		set {
		}
	}
	
	public virtual object[] PropArray {
		get {
			return null;
		}
	}
	
	internal virtual object this [int arg] {
		get {
			return 5;
		}
		set {
		}
	}
}

class B : A
{
	public override dynamic Foo ()
	{
		return 5;
	}
	
	public override dynamic[] FooArray ()
	{
		return new object [] { 'a', 'b' , 'z' };
	}
	
	internal override dynamic Prop {
		set {
		}
	}
	
	public override dynamic[] PropArray {
		get {
			return new object [] { 'a', 'b' };
		}
	}
	
	internal override dynamic this [int arg] {
		set {
		}
	}
}

class MainClass : B
{
	void Test ()
	{
		char ch;
		ch = Prop;
		ch = PropArray [1];
		ch = this [1];
	}
	
	public static int Main ()
	{
		B b = new B ();
		int res;
		res = b.Foo ();
		if (res != 5)
			return 1;
		
		char ch = b.FooArray () [1];
		if (ch != 'b')
			return 2;
		
		++b.Prop;
		res = b.Prop;
		if (res != 9)
			return 3;
		
		ch = b.PropArray [1];
		if (ch != 'b')
			return 4;
		
		res = b [3];
		if (res != 5)
			return 5;
		
		return 0;
	}
}