示例#1
0
        static void Main(string[] args)
        {
            int  wheelCount;
            bool input = false;

            do
            {
                Console.WriteLine("Enter the amount of tires for the vehicle you want to create:");
                input = int.TryParse(Console.ReadLine(), out wheelCount);
            }while (!input);

            var vehicle = VehicleFactory.GetVehicle(wheelCount);

            vehicle.Drive();
        }
示例#2
0
        static void Main(string[] args)
        {
            int  numOfWheels;
            bool input = false;

            do
            {
                Console.WriteLine("Enter the amount of tires for the vehicle you'd like to create:");

                input = int.TryParse(Console.ReadLine(), out numOfWheels);
            } while (input == false);

            var vehicle = VehicleFactory.GetVehicle(numOfWheels); // this method gives us a new vehicle

            vehicle.Drive();
        }