Exemple #1
0
        protected override IMilitaryVehicle Create(string name)
        {
            Tank tank;
            var  result = name.Replace(" ", "").ToLower();

            if (result == "tiger")
            {
                tank = new Tiger();
            }
            else if (result == "oi")
            {
                tank = new OI();
            }
            else if (result == "renault")
            {
                tank = new Renault();
            }
            else if (result == "stg")
            {
                tank = new STG();
            }
            else if (result == "churchill")
            {
                tank = new Churchill();
            }
            else
            {
                return(null);
            }
            //tank.Drive();
            return(tank);
            //return new Tiger();
        }
        //

        public Tank CreateTank(string name)
        {
            Tank tank;
            var  result = name.Replace(" ", "").ToLower();

            if (result == "tiger")
            {
                tank = new Tiger();
            }
            else if (result == "oi")
            {
                tank = new OI();
            }
            else if (result == "renault")
            {
                tank = new Renault();
            }
            else if (result == "stg")
            {
                tank = new STG();
            }
            else if (result == "churchill")
            {
                tank = new Churchill();
            }
            else
            {
                return(null);
            }
            return(tank);
        }