static void Main() { var clock = new CountdownClock(); var bath = new Bathroom(); var microwave = new Microwave(); bath.Register(clock); microwave.Register(clock); Console.WriteLine("The countdown has begun!"); clock.ImitationCountdownClock(5); bath.Unregister(clock); clock.ImitationCountdownClock(2); Console.ReadKey(); }
public void Register(CountdownClock clock) { clock.TimeUp += BathroomMsg; }
public void Unregister(CountdownClock clock) { clock.TimeUp -= BathroomMsg; }
public void Register(CountdownClock clock) { clock.TimeUp += MicrowaveMsg; }
public void Unregister(CountdownClock clock) { clock.TimeUp -= MicrowaveMsg; }