Without violating encapsulation, capture and externalize an
object's internal state so that the object can be restored to this state later.
Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored
to this state later.
## Explanation
Real world example
> We are working on astrology application where we need to analyze star properties over time. We are creating snapshots of star state using Memento pattern.
In plain words
> Memento pattern captures object internal state making it easy to store and restore objects in any point of time.
Wikipedia says
> The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo via rollback).
**Programmatic Example**
Let's first define the types of stars we are capable to handle.