2010-04-19 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / tests / iface3.cs
blob7d15381c4b7b35cc1fe886a1f60479f3071e97ec
1 using System;
3 public interface ICommon {
4 int DoIt ();
7 public class Base : ICommon {
8 int ICommon.DoIt () { return 1; }
9 public virtual int DoIt () { return 2; }
12 public class Derived : Base, ICommon {
13 int ICommon.DoIt () { return 3; }
14 public new virtual int DoIt () { return 4; }
17 public class ReallyDerived : Derived {
18 public override int DoIt () { return 5; }
21 public class Test {
23 static int Main () {
24 ReallyDerived r1 = new ReallyDerived ();
25 Derived r2 = r1;
26 Base r3 = r1;
27 ICommon r4 = r1;
28 Object r5 = r1;
30 if (r1.DoIt() != 5)
31 return 1;
33 // Console.WriteLine ("TEST {0}", ((ICommon)r1).DoIt ());
35 if (((ICommon)r1).DoIt() != 3)
36 return 2;
38 if (r2.DoIt() != 5)
39 return 3;
41 if (r3.DoIt() != 2)
42 return 4;
44 if (r4.DoIt() != 3)
45 return 5;
47 return 0;