Memento design pattern.
Problem statement – I am hoping that we all are very much familiar with text Editors (i.e., notepad++, text pad, MS word, etc.). The most important things we do there (apart from copy and pest things from one place to another place) undo and redo. Or for game lovers, many times we perform undo step to rollback our game in previous position. We wish our life could also give these two important command – undo and redo, but unfortunately, it is not there :( Now the question is, how do we achieve tremendously helping two commands undo and redo? Background – So we have a requirement of storing an object. The question here is, w hat we have understood from OOAD designs; is do not assign any responsibility to any class. If that responsibility is not related to the class's core behavior. For Instance doing undo and redo is not the core behavior of TextEditor class. So we would implement a class who perform undo and redo for TextEditor class. Whe...