Esempio n. 1
0
        public Animal createAnimal(int animalCode)
        {
            Animal newAnimal = null;

            switch (animalCode)
            {
                case 0:
                    newAnimal = new GiantPanda();
                    break;
                case 1:
                    newAnimal = new AsianElephant();
                    break;
                case 2:
                    newAnimal = new MalayanTapir();
                    break;
            }
            return newAnimal;
        }
Esempio n. 2
0
        public Animal createAnimal(int animalCode)
        {
            Animal newAnimal = null;

            switch (animalCode)
            {
            case 0:
                newAnimal = new GiantPanda();
                break;

            case 1:
                newAnimal = new AsianElephant();
                break;

            case 2:
                newAnimal = new MalayanTapir();
                break;
            }
            return(newAnimal);
        }