mirror of
https://github.com/JakubVojvoda/design-patterns-cpp.git
synced 2025-12-17 12:54:36 +03:00
10 lines
455 B
Markdown
10 lines
455 B
Markdown
## Memento
|
|
|
|
Memento without violating encapsulation, captures and externalizes an object's internal
|
|
state so that the object can be restored to this state later. The pattern has behavioral
|
|
purpose and applies to the objects.
|
|
|
|
### When to use
|
|
|
|
* a snapshot of an object's state must be saved so that it can be restored to that state later
|
|
* a direct interface to obtaining the state would expose implementation details and break the object's encapsulation |