Design Patterns - Memento

Memento Pattern is a behavioral design pattern which provides the ability to restore an object to it’s previous state. It solves the problem to restore an object back to this previous state providing “Undo” or “Rollback” operations.

Memento Design Pattern is implemented with three objects:

  • Originator - Responsible for Creating and Saving State in Memento Object.
  • Caretaker - Responsible for restoring object state from Memento.
  • Memento - State of an object to be restored

Momento Design Pattern