日期:2014-05-18 浏览次数:20421 次
public interface IClass1 { void Info(); } public class Class2 : IClass1 { public void Info(){//... System.Console.WriteLine("it's Class2!"); } } public class Class3 : IClass1 { public void Info(){//... System.Console.WriteLine("it's a Class3!"); } } public static void Main() { IClass1 cls = new Class2(); cls.Info(); cls = new Class3(); cls.Info(); }