static void StatePattern() { Console.WriteLine("\n\nState Pattern"); var context = new StatePattern.Context(); context.SetState(new ConcreteStateA()); context.GetCurrentState().Handle(); context.SetState(new ConcreteStateB()); context.GetCurrentState().Handle(); }
public void Handle(Context context) { Console.WriteLine("检查货物,没问题可以签收!"); context.SetState(new Success()); //context.Request(); }