2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / tests / test-70.cs
1 //
2 // Tests the right settings for overrides
3 //
4
5 class X {
6
7         public virtual int A {
8                 get {
9                         return 1;
10                 }
11         }
12
13         public virtual int B ()
14         {
15                 return 1;
16         }
17 }
18
19 class Y : X {
20         public override int A {
21                 get {
22                         return base.A + 2;
23                 }
24         }
25
26         public override int B ()
27         {
28                 return base.B () + 1;
29         }
30 }
31
32 class Z {
33         static int Main ()
34         {
35                 Y y = new Y ();
36                 X x = new X ();
37                                        
38                 if (y.B () != 2)
39                         return 1;
40                 if (y.A != 3)
41                         return 2;
42                 if (x.A != 1)
43                         return 3;
44                 if (x.B () != 1)
45                         return 4;
46                 return 0;
47         }
48 }