public static int Main() { Console.WriteLine("test"); TestClass tst = new TestClass(); tst.test("test"); TestInterface ti = (TestInterface)tst; ti.test("test"); return(0); }
static void Interface() { car c = new car(); TestLibrary.Interface.Bike b = new TestLibrary.Interface.Bike(); Vehicles v = (Vehicles)c; v.PrintVal(); v = (Vehicles)b; v.PrintVal(); TestLibrary.Interface.Bus bus = new TestLibrary.Interface.Bus(); Vehicle1 v1 = (Vehicle1)bus; v1.PrintData(); v1 = (Vehicle1)c; v1.PrintData(); TestInterface t = (TestInterface)b; t.test(); t = (TestInterface)bus; t.test(); Common com = (Common)c; com.run(12); com = (Common)b; com.run(14); com = (Common)bus; com.run(50); }