static void Main(string[] args) { TurnstileController controller = new TurnstileController(); Turnstile turnstile = new Turnstile(controller); turnstile.ProcessEvent(Turnstile.COIN); // Imprime: Desbloqueado! turnstile.ProcessEvent(Turnstile.PASS); // Imprime: Te bloqueo! turnstile.ProcessEvent(Turnstile.PASS); // Imprime: ALARMAAAAAAAAAAAA! Console.ReadKey(); }
public Turnstile(TurnstileController controller) { state = LOCKED; turnstileController = controller; }