2010-06-21 Atsushi Enomoto <atsushi@ximian.com>
[mcs.git] / tests / test-20.cs
blob006bd45075e274947002ddef33df6462e86e4eac
1 //
2 // This generates a warning
3 //
4 using System;
6 class A {
7 public int a;
9 public void X ()
11 a = 1;
15 class B : A {
16 void X ()
18 a = 2;
21 public void TestB ()
23 X ();
27 class Ax {
28 public int a;
30 public virtual void A ()
32 a = 1;
35 public virtual void B ()
37 a = 3;
41 class Bx : Ax {
42 public override void A ()
44 a = 2;
46 public new void B ()
48 a = 4;
51 class Test {
52 static int Main ()
54 B b = new B ();
56 b.TestB ();
57 if (b.a != 2)
58 return 1;
60 Bx bx = new Bx ();
61 bx.A ();
62 if (b.a != 2)
63 return 2;
64 bx.B ();
65 Console.WriteLine ("a="+bx.a);
66 if (bx.a != 4)
67 return 3;
68 return 0;