3 public interface IVehicle
{
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; }
28 public override int Turn () { return 8; }
34 Derived1 d1
= new Derived1 ();
35 Derived2 d2
= new Derived2 ();
42 if (((IVehicle
)d1
).Turn () != 4)
45 if (((IVehicle
)d2
).Turn () != 7)
51 if (((IVehicle
)b2
).Turn () != 7)
54 //Console.WriteLine ("TEST {0}", ((IVehicle)b2).Turn ());