SOMETIMES, THE OBJECT you want to create is one that existed previously. This occurs when you want to let a user undo operations, revert to an earlier version of work, or resume previously suspended work.
The intent of the MEMENTO pattern is to provide storage and restoration of an object’s state.
A Classic Example: Using Memento for Undo
Chapter 17, ABSTRACT FACTORY, introduced a visualization application that lets users perform operational modeling experiments with material flow through a factory. Suppose that the functionality for the Undo button has not yet been implemented. We can apply the MEMENTO pattern to make the Undo button work.
A memento is an object that holds state information. In the visualization application, ...