


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Memento Pattern George Blankenship 1
Memento Pattern George Blankenship 2
Memento Pattern George Blankenship 3
Memento Pattern George Blankenship 4
Memento Pattern George Blankenship 5
Memento Pattern George Blankenship 6
// write the object named someObject to file "file.dat" try { OutputStream os = new FileOutputStream(" file.dat "); ObjectOutputStream oos = new ObjectOutputStream (os); oos. writeObject ( someObject ); os.close(); } catch (IOException e) { ... }
// load the object named someObject from file "file.dat" try { InputStream is = new FileInputStream(" file.dat "); ObjectInputStream ois = new ObjectInputStream (is); ArrayList someList = ( ArrayList ) ois. readObject (); is.close(); } catch (Exception e) { ... }
Memento Pattern George Blankenship 10
The Memento Pattern: Consequences
Memento Pattern George Blankenship 11
The Memento Pattern: Implementation
and Caretaker into one object.
changes. This will help to save space.
Iterator and Singleton design patterns.
depending on the programming language. Implement
the Originator as a friend class to the Memento in C++.
Implement the Memento as an inner-class of the
Originator in Java.