Esempio n. 1
0
        static void Main(string[] args)
        {
            Monkey m = new Monkey();
            Pigeon p = new Pigeon();
            Lion l = new Lion();

            Feeder f = new Feeder();
            f.Name = "小李";

            f.FeedAnimal(m);//喂猴子
            f.FeedAnimal(p);//喂鸽子
            f.FeedAnimal(l);//喂狮子

            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Monkey m = new Monkey();
            Pigeon p = new Pigeon();
            Lion   l = new Lion();

            Feeder f = new Feeder();

            f.Name = "小李";

            f.FeedAnimal(m); //喂猴子
            f.FeedAnimal(p); //喂鸽子
            f.FeedAnimal(l); //喂狮子

            Console.ReadKey();
        }