Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Look at a dirty car. If a car is clean you will see 'True'");
            Garage garage = new Garage();
            Car    car1   = new Car("AUDI A6");
            Car    car2   = new Car("BMW X8");
            Car    car3   = new Car("VAZ 3310");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            foreach (var car in garage)
            {
                Console.WriteLine(car.name + " " + car.clean);
            }

            Console.WriteLine("Lets wash all our cars. If car is clean you will see 'True'");
            foreach (var car in garage)
            {
                Washer washer = new Washer();
                Wash   del    = washer.Wash;
                del(car);
                Console.WriteLine(car.name + " " + car.clean);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Список брудних машин. Якщо машина буде чистою ви побачите вiдмiтку 'True'");
            Garage garage = new Garage();
            Car    car1   = new Car("Geely");
            Car    car2   = new Car("Chery");
            Car    car3   = new Car("Toyota");
            Car    car4   = new Car("Bugatti");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            garage.Add(car4);
            foreach (var car in garage)
            {
                Console.WriteLine(car.name + " " + car.clean);
            }
            Console.WriteLine("Якщо машина пiсля мийки буде чистою ви побачите вiдмiтку 'True'");
            foreach (var car in garage)
            {
                Washer washer = new Washer();
                W      del    = washer.Wash;
                del(car);
                Console.WriteLine(car.name + " " + car.clean);
            }
            Console.ReadKey();
        }
Пример #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Look at a dirty car. If a car is clean you will see 'True'");
            Garage garage = new Garage();
            Car    car1   = new Car("Geely Emgrand 7");
            Car    car2   = new Car("Honda Civic");
            Car    car3   = new Car("Subaru Impreza");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            foreach (var car in garage)
            {
                Console.WriteLine(car.name + " " + car.clean);
            }

            Console.WriteLine("Lets wash all our cars. If car is clean you will see 'True'");
            foreach (var car in garage)
            {
                Washer washer = new Washer();
                Wash   del    = washer.Wash;
                del(car);
                Console.WriteLine(car.name + " " + car.clean);
            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("-------------------------------------------------------");
            Garage garage = new Garage();
            Car    car1   = new Car("Tesla Model X");
            Car    car2   = new Car("BMW X6 M");
            Car    car3   = new Car("Ford Mustang GT");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            foreach (var car in garage)
            {
                Console.WriteLine(car.name + " |is clean?|  " + car.clean);
            }
            Console.WriteLine("-------------------------------------------------------");
            Console.WriteLine("Пiсля автомийки:");
            foreach (var car in garage)
            {
                Washer washer = new Washer();
                Wash   del    = washer.Wash;
                del(car);
                Console.WriteLine(car.name + "  |is clean?|  " + car.clean);
            }
            Console.ReadKey();
        }
Пример #5
0
        static void Main(string[] args)
        {
            Garage garage = new Garage();
            Car    car1   = new Car("mazda");
            Car    car2   = new Car("BMW");
            Car    car3   = new Car("Toyota");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            foreach (var car in garage)
            {
                Console.WriteLine(car.name + " " + car.clean);
            }
            Console.WriteLine("");
            foreach (var car in garage)
            {
                Washer washer = new Washer();
                Wa     del    = washer.Wash;
                del(car);
                Console.WriteLine(car.name + " " + car.clean);
            }
            Console.ReadKey();
        }
Пример #6
0
        static void Main(string[] args)
        {
            Garage garage = new Garage();
            Car    car1   = new Car("Renault");
            Car    car2   = new Car("Skoda");
            Car    car3   = new Car("Porshe", true);
            Car    car4   = new Car("Cadillac");
            Car    car5   = new Car("Bentley");

            garage.Add(car1);
            garage.Add(car2);
            garage.Add(car3);
            garage.Add(car4);
            garage.Add(car5);

            Console.WriteLine("Список машин та статус очистки.");
            Console.WriteLine();

            foreach (var index in garage)
            {
                Console.WriteLine(index);
            }
            Console.WriteLine();
            Console.WriteLine("Чистка...");
            Console.WriteLine();

            Washer       washer      = new Washer();
            WashDelegate washMachine = washer.Wash;

            foreach (var car in garage)
            {
                washMachine(car);
                Console.WriteLine(car);
            }
            Console.ReadKey();
        }