Пример #1
0
        static void TrainDelegateExaple()
        {
            TrainSignalDelegate tsd = new TrainSignalDelegate();

            new Vehicle(tsd);
            new Truck(tsd);
            new Bike(tsd);
            new Vehicle(tsd);
            new Vehicle(tsd);
            tsd.HereComesTheTarin();
        }
 public Bike(TrainSignalDelegate trainSignal) : base(trainSignal)
 {
 }
 public Truck(TrainSignalDelegate trainSignal) : base(trainSignal)
 {
 }
 public Vehicle(TrainSignalDelegate trainSignal)
 {
     trainSignal.comingEvent += StopTheVehicle;
 }