예제 #1
0
    static void Main(string[] args)
    {
        IAnimal life1 = new Life();
        //Life life2=new Life();  像这样定义没办法使用Breath方法,会出错,所以定义只能是IPlant life2=new Life()。
        IPlant life2 = new Life();

        life1.Breath();
        life2.Breath();
        Console.Read();
    }