The mental pattern is used whenever you want to restore an object to a previous state.
This is equivalent to providing an undue functionality in your application.
An example of usage of this pattern in the Java API are the Java dot to date into Java that are your
serializable interface.
The serializable interface allows you to have an object with regretable state.
This is how the UML diagram, for this matter, looks like we have an originator, which is the object
for which we want to perform a snapshot than the mental object contains the state of the originator
and it is also able to retrieve that state.
A copy of the state is safe in the caretaker class.
Some of the weaknesses are it can create a memory overhead by storing multiple states of an object.
This can be addressed by deleting the history of states after a certain number of states.
Also, the information about the originator may be exposed to this matter, and this is why you need
to be extra careful when dealing with this and not exposing the state to other objects.
Just a moment of.
Let's see how this button can be implemented in local.