static void Main(string[] args) { Context context = new Context(new StateA()); context.ChangeState(); context.ChangeState(); Console.ReadLine(); }
public void DoClock(Context context, int hour) { if (9 <= hour && hour < 17) { context.ChangeState(DayState.GetInstance()); } }
public void DoClock(Context context, int hour) { if (hour < 9 || 17 <= hour) { context.ChangeState(NightState.GetInstance()); } }