public void Run() { State s = new State(); s.A = "a"; Originator o = new Originator(s); Mementor m = o.CraeteMementor(); CareTaker c = new CareTaker(); c.Add(m); o.SetState(c.Restore()); }
public Mementor(State st) { this.state = (State)st.Clone(); }
public void SetState(Mementor m) { this.state = m._State; }
public object Clone() { State state = new State(); state.A = a; return state; }
public Originator(State st) { this.state = (State)st.Clone(); }