//Зберігач - Token, Memento public Run Memento() { Console.WriteLine("\nMemento:"); Originator o = new Originator(); o.State = "On"; // Store internal state Caretaker c = new Caretaker(); c.Memento = o.CreateMemento(); // Continue changing originator o.State = "Off"; // Restore saved state o.SetMemento(c.Memento); return this; }
public Caretaker(Originator originator) { _originator = originator; }