Exemple #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.HereComesATrain();
        }
Exemple #2
0
 public Car(TrainSignal trainSignal)
 {
     trainSignal.TrainsAComing += StopTheCar;
 }