Example #1
0
        public static Reptile CreateReptile(ReptileSpecies Species)
        {
            Reptile animalObj = null;//Animaltype unknown at this time.

            //Lets determine users choice of animal.
            switch (Species)
            {
                case ReptileSpecies.Alligator:
                    animalObj = new Alligator();
                    break;
                case ReptileSpecies.Cobra:
                    animalObj = new Cobra();
                    break;
                case ReptileSpecies.Komodo:
                    animalObj = new Komodo();
                    break;

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

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

            return animalObj;//Return created instance of object.
        }
Example #2
0
        public static Reptile CreateReptile(ReptileSpecies Species)
        {
            Reptile animalObj = null;//Animaltype unknown at this time.

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

            case ReptileSpecies.Cobra:
                animalObj = new Cobra();
                break;

            case ReptileSpecies.Komodo:
                animalObj = new Komodo();
                break;

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

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

            return(animalObj);//Return created instance of object.
        }