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

test-56.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b5ca96b7baf0e0ac242bc3d7633a6ea874c21aee (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
//
// Stress test properties and the various modes of 
// declarations (virtual, overrides, abstract, new)
//
using System;

interface I {
	int P {
		get; set;
	}
}

abstract class A : I {
	public int p;
	public int q;
	
	public int P {
		get { return p; }
		set { p = value; }
	}

	public abstract int Q { get; set; }

	public int r;
	public virtual int R { get { return r; } set { r = value; } }
}

class B : A {
	public int bp;

	public new int P
	{
		get { return bp; }
		set { bp = value; }
	}

	public override int Q {
		get { return q; }
		set { q = value; }
	}
}

class C : A {
	public override int Q {
		get { return q; }
		set { q = value; }
	}

	public int rr;
	public override int R { get { return rr; } set { rr = value; } }
}

class M {

	public static int Main ()
	{
		B b = new B ();

		b.P = 1;
		b.R = 10;
		b.Q = 20;
				 
		if (b.P != 1)
			return 1;
		if (b.bp != 1)
			return 2;

		if (b.R != 10)
			return 3;
		if (b.r != 10)
			return 4;

		if (b.Q != 20)
			return 5;
		if (b.q != 20)
			return 6;

		C c = new C ();

		c.R = 10;
		c.Q = 20;
		c.P = 30;
		if (c.R != 10)
			return 7;
		if (c.rr != 10)
			return 8;
		if (c.P != 30)
			return 9;
		if (c.p != 30)
			return 10;

		Console.WriteLine ("Test passes");
		return 0;
	}
}