Exemplo n.º 1
0
        static void Main(string[] args)
        {
            TrainSignal trainSignal = new TrainSignal();

            new Car(trainSignal);
            new Car(trainSignal);
            new Car(trainSignal);
            new Car(trainSignal);
            new Car(trainSignal);
            //trainSignal.TrainsAComing();
            //trainSignal.TrainsAComing();
            //trainSignal.TrainsAComing();
            //trainSignal.TrainsAComing();
            //trainSignal.TrainsAComing = null;
            trainSignal.HereComesATrain();
        }
Exemplo n.º 2
0
 public Car(TrainSignal trainSignal)
 {
     trainSignal.TrainsAComing += StopTheCar;
 }