protected Command(Receiver receiver) { this.receiver = receiver; }
public CommandPattern() { Receiver receiver = new Receiver(); Command command = new ConcreteCommand(receiver); Invoker invoker = new Invoker(); invoker.SetCommand(command); invoker.ExecuteCommand(); command = null; invoker.ExecuteCommand(); //把command赋值为空,但请求者实体里面的command没变,所以还是会执行 }
public ConcreteCommand(Receiver receiver) : base(receiver) { }