Esempio n. 1
0
        public static Racer FactoryMethod(CommonClass.Racer_Type type)
        {
            switch (type)
            {
            case CommonClass.Racer_Type.Tortoise1: return(new Tortoise1());

            case CommonClass.Racer_Type.Tortoise2: return(new Tortoise2());

            case CommonClass.Racer_Type.Tortoise3: return(new Tortoise3());

            case CommonClass.Racer_Type.Tortoise4: return(new Tortoise4());

            default: throw new NotImplementedException("Tortoise Class not found !!!");
            }
        }
Esempio n. 2
0
        public static AbstractRacer FactoryMethod(CommonClass.Racer_Type type)
        {
            switch (type)
            {
            case CommonClass.Racer_Type.Small: return(new SmallRacer());

            case CommonClass.Racer_Type.Medium: return(new MediumRacer());

            case CommonClass.Racer_Type.Large: return(new LargeRacer());

            case CommonClass.Racer_Type.Giant: return(new GiantRacer());

            default: throw new NotImplementedException("Racer Class Not Defined !!!");
            }
        }