コード例 #1
0
        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();
        }
コード例 #2
0
 public Turnstile(TurnstileController controller)
 {
     state = LOCKED;
     turnstileController = controller;
 }