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

test-169.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2051287e49570098ba23ab34c1256a62865f5bf1 (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
//
// Test for overloaded properties.
//
using System;

public class basec {
	public virtual string Message {
		get {
			return "base";
		}
	}
}

public class der : basec {
	public override string Message {
		get {
			return "der";
		}
	}
}

class Base {
        int thingy = 0;
        public virtual int Thingy {
                get { return thingy; }
                set { thingy = value; }
        }
}

class Derived : Base {
        public int BaseThingy {
                get { return Thingy; }
        }

        public override int Thingy {
                // override the set constructor
                set { }
        }
}

class D {

	public static int Main ()
	{
		//
		// These tests just are compilation tests, the new property code
		// will excercise these
		//
		der d = new der ();
		if (d.Message != "der")
			return 1;

		basec b = new basec ();
		if (b.Message != "base")
			return 2;

		Derived dd = new Derived ();
		dd.Thingy = 10;
		if (dd.BaseThingy != 0)
			return 3;

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