Fix LLVM linker flags for 6.0.
[mono-project.git] / mcs / tests / test-56.cs
blobb5ca96b7baf0e0ac242bc3d7633a6ea874c21aee
1 //
2 // Stress test properties and the various modes of
3 // declarations (virtual, overrides, abstract, new)
4 //
5 using System;
7 interface I {
8 int P {
9 get; set;
13 abstract class A : I {
14 public int p;
15 public int q;
17 public int P {
18 get { return p; }
19 set { p = value; }
22 public abstract int Q { get; set; }
24 public int r;
25 public virtual int R { get { return r; } set { r = value; } }
28 class B : A {
29 public int bp;
31 public new int P
33 get { return bp; }
34 set { bp = value; }
37 public override int Q {
38 get { return q; }
39 set { q = value; }
43 class C : A {
44 public override int Q {
45 get { return q; }
46 set { q = value; }
49 public int rr;
50 public override int R { get { return rr; } set { rr = value; } }
53 class M {
55 public static int Main ()
57 B b = new B ();
59 b.P = 1;
60 b.R = 10;
61 b.Q = 20;
63 if (b.P != 1)
64 return 1;
65 if (b.bp != 1)
66 return 2;
68 if (b.R != 10)
69 return 3;
70 if (b.r != 10)
71 return 4;
73 if (b.Q != 20)
74 return 5;
75 if (b.q != 20)
76 return 6;
78 C c = new C ();
80 c.R = 10;
81 c.Q = 20;
82 c.P = 30;
83 if (c.R != 10)
84 return 7;
85 if (c.rr != 10)
86 return 8;
87 if (c.P != 30)
88 return 9;
89 if (c.p != 30)
90 return 10;
92 Console.WriteLine ("Test passes");
93 return 0;