コード例 #1
0
        static void Main()
        {
            Car        car     = new Car();
            CarMonitor monitor = new CarMonitor(car);

            car.Start();
            while (car.EngineOn)
            {
                car.Decelerate();
            }

            car.Start();
            for (int i = 0; i < 100; i++)
            {
                car.Accelerate();
            }

            ElectricCar ec = new ElectricCar();

            ec.Start();
            while (ec.EngineOn)
            {
                ec.Decelerate();
            }

            Moto moto = new Moto();

            moto.Event1 += moto_Event1;
            moto.RaiseEvent1();
            moto.Event1 -= moto_Event1;
        }
コード例 #2
0
        static void Main()
        {
            Car car = new Car();
            CarMonitor monitor = new CarMonitor(car);
            car.Start();
            while (car.EngineOn)
                car.Decelerate();

            car.Start();
            for (int i = 0; i < 100; i++)
                car.Accelerate();

            ElectricCar ec = new ElectricCar();
            ec.Start();
            while (ec.EngineOn)
                ec.Decelerate();

            Moto moto = new Moto();
            moto.Event1 += moto_Event1;
            moto.RaiseEvent1();
            moto.Event1 -= moto_Event1;
        }