Exemple #1
0
        static void Main()
        {
            List <IAnimal> listDV = new List <IAnimal>();

            //List<IMarineAnimal> listM = new List<IMarineAnimal>();
            //List<ITerrestrialAnimal> listT = new List<ITerrestrialAnimal>();

            Console.OutputEncoding = Encoding.UTF8;
            Menu();
            bool check;
            int  pick;

            check = int.TryParse(Console.ReadLine(), out pick);
            while (!check || pick < 1 || pick > 8)
            {
                Console.WriteLine("--------------------------------");
                Console.WriteLine("nhap sai, nhap lai di");
                Menu();
                check = int.TryParse(Console.ReadLine(), out pick);
            }
            Cat       cat  = new Cat();
            Fish      fist = new Fish();
            Crocodile cro  = new Crocodile();

            switch (pick)
            {
            case 1:
                Console.WriteLine("de ra ca sau");
                cro.ID   = 5;
                cro.Name = "XAU XAU";
                cro.move();
                listDV.Add(cro);
                Main();
                break;

            case 6:
                Console.WriteLine("DANH SÁCH ĐỘNG VẬT");
                foreach (var bikes in listDV)
                {
                    Console.WriteLine(bikes.ToString());
                }
                break;

            case 8:

                break;
            }
        }