Polski

Behavioral patterns

Memento

Captures and restores an object's state without breaking its encapsulation.

Article

Memento: a state snapshot without breaking encapsulation

The Memento pattern through a menu editor: Halina saves versions of the menu and returns to them with one click, while the history keeps snapshots without seeing what is inside. Copies instead of references, memory costs and code in five languages.

Related articles

Challenges

Around the topic

In this group: Behavioral patterns