Пример #1
0
        public static MarineAnimal CreateMarine(MarineSpecies Species)
        {
            MarineAnimal animalObj = null;//Marine animal type not know yet.

            //Lets determine users choice of animal.
            switch (Species)
            {
            case MarineSpecies.Crayfish:
                animalObj = new Crayfish();
                break;

            case MarineSpecies.Salmon:
                animalObj = new Salmon();
                break;

            default:
                Debug.Assert(false, "Not implemented");
                break;
            }

            //Set animal category
            animalObj.Category = CategoryType.Marine;

            return(animalObj);//Return created instance of object marine animal
        }
Пример #2
0
        public static MarineAnimal CreateMarine(MarineSpecies Species)
        {
            MarineAnimal animalObj = null;//Marine animal type not know yet.

            //Lets determine users choice of animal.
            switch (Species)
            {
                case MarineSpecies.Crayfish:
                    animalObj = new Crayfish();
                    break;
                case MarineSpecies.Salmon:
                    animalObj = new Salmon();
                    break;

                default:
                    Debug.Assert(false, "Not implemented");
                    break;
            }

            //Set animal category
            animalObj.Category = CategoryType.Marine;

            return animalObj;//Return created instance of object marine animal
        }