This chapter covers the Memento pattern.
GoF Definition
Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later.
Concept
The dictionary definition of the word memento is that it’s a reminder of past events. When using this pattern, you can restore an object to its previous state. This pattern provides an object-oriented way to save the state of an object.
Real-Life Example
You can see a classic example of the Memento pattern in the states of a finite state machine. This pattern is a mathematical ...