Warnings cleanup
[mcs.git] / tests / test-94.cs
bloba8c5fea996fcd814f5ca78d08a7192d4292b3aa7
1 using System;
3 public interface IVehicle {
4 int Start ();
5 int Stop ();
6 int Turn ();
9 public class Base : IVehicle {
10 int IVehicle.Start () { return 1; }
11 public int Stop () { return 2; }
12 public virtual int Turn () { return 3; }
15 public class Derived1 : Base {
16 // replaces Base.Turn + IVehice.Turn
17 public override int Turn () { return 4; }
20 public class Derived2 : Base, IVehicle {
21 // legal - we redeclared IVehicle support
22 public new int Stop () { return 6; }
23 // legal - we redeclared IVehicle support
24 int IVehicle.Start () { return 5; }
25 // replaces IVehicle.Turn
26 int IVehicle.Turn () { return 7; }
27 // replaces Base.Turn
28 public override int Turn () { return 8; }
31 public class Test {
33 static int Main () {
34 Derived1 d1 = new Derived1 ();
35 Derived2 d2 = new Derived2 ();
36 Base b1 = d1;
37 Base b2 = d2;
39 if (d1.Turn () != 4)
40 return 1;
42 if (((IVehicle)d1).Turn () != 4)
43 return 2;
45 if (((IVehicle)d2).Turn () != 7)
46 return 3;
48 if (b2.Turn () != 8)
49 return 4;
51 if (((IVehicle)b2).Turn () != 7)
52 return 5;
54 //Console.WriteLine ("TEST {0}", ((IVehicle)b2).Turn ());
56 return 0;