1 // Some interfaces, one is a superset of the other
6 public interface FileNode
: Node
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
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
);
47 System
.Console
.WriteLine("{0} -- FAILED", name
);
52 public static int Main()
54 if( Test(new WorkingTest(), "WorkingTest")
55 && Test(new FailingTest(), "FailingTest") )
56 return 0; // everything worked