Memento Pattern

The Memento Pattern is a behavioral design pattern that provides a way to capture and restore an object’s state without exposing its internal details. This pattern is particularly useful for implementing undo functionality and maintaining encapsulation in software design.