add Memento pattern

This commit is contained in:
Jakub Vojvoda
2016-09-29 16:04:08 +02:00
parent 555f1c9a8f
commit 1b97de7a27
2 changed files with 134 additions and 0 deletions

10
memento/README.md Normal file
View File

@@ -0,0 +1,10 @@
## 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