示例#1
0
        static void Main(string[] args)
        {
            Cage <Animal> cage   = new Cage <Animal>();
            Monkey        monkey = new Monkey("Klaus");

            cage.AddAnimal(monkey);
            Tiger tiger = new Tiger("Mickey");

            cage.AddAnimal(tiger);
            cage.RemoveAnimal(tiger);
            cage.showAnimalsInCage();
        }
示例#2
0
文件: Program.cs 项目: smo1982/Cage
        static void Main(string[] args)
        {
            Monkey        monkey     = new Monkey("Aff");
            Tiger         tiger      = new Tiger("katz");
            Cage <Monkey> monkeyCage = new Cage <Monkey>();

            monkeyCage.AddAnimal(monkey);
            Cage <Tiger> tigerCage = new Cage <Tiger>();

            tigerCage.AddAnimal(tiger);
            monkeyCage.PrintAnimal();
            tigerCage.PrintAnimal();
            monkeyCage.RemoveAnimal(monkey);
            monkeyCage.PrintAnimal();
            tigerCage.PrintAnimal();
            Console.ReadKey();
        }