This chapter covers the Memento pattern.
GoF Definition
Without violating encapsulation, the Memento pattern captures and externalizes an object’s internal state so that the object can be restored to this state later.
Concept
As per the dictionary, the word memento is used as a reminder of past events. Following the object-oriented way, you can also track (or save) the states of an object. So, whenever you want to restore an object to its previous state, you can consider using this pattern.
In this pattern, you commonly see three ...