Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / iface3.cs
1 using System;
2
3 public interface ICommon {
4         int DoIt ();
5 }
6
7 public class Base : ICommon {
8         int ICommon.DoIt () { return 1; }
9         public virtual int DoIt () { return 2; }
10 }
11
12 public class Derived : Base, ICommon {
13         int ICommon.DoIt () { return 3; }
14         public new virtual int DoIt () { return 4; }
15 }
16
17 public class ReallyDerived : Derived {
18         public override int DoIt () { return 5; }
19 }
20
21 public class Test {
22
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;
29
30                 if (r1.DoIt() != 5)
31                         return 1;
32
33                 //              Console.WriteLine ("TEST {0}", ((ICommon)r1).DoIt ());
34
35                 if (((ICommon)r1).DoIt() != 3)
36                         return 2;
37
38                 if (r2.DoIt() != 5)
39                         return 3;
40                 
41                 if (r3.DoIt() != 2)
42                         return 4;
43                 
44                 if (r4.DoIt() != 3)
45                         return 5;
46                 
47                 return 0;
48         }
49 }