Which of the following correctly represents the key components of the Memento pattern?
easy🧠 Conceptual Q12 of 15
LLD - Behavioral Design Patterns — Part 2
Which of the following correctly represents the key components of the Memento pattern?
ASubject, Observer, ConcreteObserver
BOriginator, Memento, Caretaker
CClient, Proxy, RealSubject
DComponent, Decorator, ConcreteComponent
Step-by-Step Solution
Solution:
Step 1: Identify components of Memento pattern
The Memento pattern consists of three main parts: Originator (the object whose state is saved), Memento (the object storing the state), and Caretaker (manages mementos).
Step 2: Eliminate other patterns
Options B, C, and D correspond to Observer, Proxy, and Decorator patterns respectively, which are unrelated to Memento.