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

            switch(animalCode)
            {
                case 0:
                    newAnimal = new Bison();
                    break;
                case 1:
                    newAnimal = new Wolf();
                    break;
                case 2:
                    newAnimal = new Eagle();
                    break;
                case 3:
                    newAnimal = new Groundhog();
                    break;

            }
            return newAnimal;
        }
Ejemplo n.º 2
0
        public Animal createAnimal(int animalCode)
        {
            Animal newAnimal = null;

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

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

            case 2:
                newAnimal = new Eagle();
                break;

            case 3:
                newAnimal = new Groundhog();
                break;
            }
            return(newAnimal);
        }