dimanche 10 novembre 2019

What does "without violating encapsulation" mean in Memento pattern

Wikipedia's description of the Memento pattern states that:

  • The internal state of an object should be saved externally so that the object can be restored to this state later.

  • The object's encapsulation must not be violated.

I am confused as to how can encapsulation be violated? Is it referring to the getter methods of the fields stored in memento?

Aucun commentaire:

Enregistrer un commentaire