예제 #1
0
        static void Main(string[] args)
        {
            Context context = new Context(new StateA());

            context.ChangeState();
            context.ChangeState();

            Console.ReadLine();
        }
예제 #2
0
 public void DoClock(Context context, int hour)
 {
     if (9 <= hour && hour < 17)
     {
         context.ChangeState(DayState.GetInstance());
     }
 }
예제 #3
0
 public void DoClock(Context context, int hour)
 {
     if (hour < 9 || 17 <= hour)
     {
         context.ChangeState(NightState.GetInstance());
     }
 }