add ISafeSerializationData
[mcs.git] / tests / test-372.cs
blob7393cde9149f7132f8b9c6d4f26d8e2d6e494a71
1 // Some interfaces, one is a superset of the other
2 public interface Node
3 {
4 int GetStat();
5 }
6 public interface FileNode : Node
7 {
8 int NotUsed();
9 }
11 // Some basic implementations, one is a superset of the other
12 public class GenericNode : Node
14 public virtual int GetStat() { return 0; }
17 public class GenericFileNode : GenericNode , FileNode
19 public virtual int NotUsed() { return -1; }
23 // Now the ability to override a method depends on if we specify again that we
24 // implement an interface -- although we must because we derive from a class
25 // that does.
26 public class WorkingTest : GenericFileNode , FileNode
28 public override int GetStat() { return 42; }
31 public class FailingTest : GenericFileNode
33 // This never gets called, but it builds, so what did we override?!!!
34 public override int GetStat() { return 42; }
37 public class TestWrapper
39 static bool Test(Node inst, string name)
41 if(inst.GetStat() == 42)
43 System.Console.WriteLine("{0} -- Passed", name);
44 return true;
45 } else
47 System.Console.WriteLine("{0} -- FAILED", name);
48 return false;
52 public static int Main()
54 if( Test(new WorkingTest(), "WorkingTest")
55 && Test(new FailingTest(), "FailingTest") )
56 return 0; // everything worked
57 else
58 return 1;