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
In your application, you may need to support “undo” operations. To achieve this, you need to record the internal state of an object. So, you must save this state information in a place that can be referred again to revert back the old state of the object. But in general, objects encapsulate their states, and those states are inaccessible to the outer world. So, if you expose the state ...