Beispiel #1
0
        // Restores the Originator's state from a memento object.
        public void Restore(Memento memento)
        {
            if (!(memento is DefaultMemento))
            {
                throw new Exception("Unknown memento class " + memento.ToString());
            }

            this.state = ((DefaultMemento)memento).GetState();
            Console.Write("Originator: My state has changed to: " + this.state);
        }