Esempio n. 1
0
        public static Vehicle CreateVehicle(eVehicleOption i_ChonsenVehicle, string i_LicenceNum, string i_Model)
        {
            Vehicle newVehicle = null;

            switch (i_ChonsenVehicle)
            {
            case eVehicleOption.FuelCar:
                newVehicle = new FuelCar(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.ElecticCar:
                newVehicle = new ElectricCar(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.FuelMotorcycle:
                newVehicle = new FuelMotorcycle(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.ElectricMotorcycle:
                newVehicle = new ElectricMotorcycle(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.FuelTrack:
                newVehicle = new FuelTrack(i_LicenceNum, i_Model);
                break;
            }

            return(newVehicle);
        }
        public static Vehicle BuildVehicle(eVehicleType i_VehicleType, string i_LicenseNumber, string i_ModelType, string i_ManufacturerName)
        {
            Vehicle newVehicle = null;

            switch (i_VehicleType)
            {
            case eVehicleType.ElectricCar:
            {
                newVehicle = new ElectricCar(i_LicenseNumber, i_ModelType, i_ManufacturerName);
                break;
            }

            case eVehicleType.ElectricMotorcycle:
            {
                newVehicle = new ElectricMotorcycle(i_LicenseNumber, i_ModelType, i_ManufacturerName);
                break;
            }

            case eVehicleType.FuelCar:
            {
                newVehicle = new FuelCar(i_LicenseNumber, i_ModelType, i_ManufacturerName);
                break;
            }

            case eVehicleType.FuelMotorcycle:
            {
                newVehicle = new FuelMotorcycle(i_LicenseNumber, i_ModelType, i_ManufacturerName);
                break;
            }

            case eVehicleType.FuelTruck:
            {
                newVehicle = new FuelTruck(i_LicenseNumber, i_ModelType, i_ManufacturerName);
                break;
            }
            }

            return(newVehicle);
        }