开发者

I need a design pattern to provide undo functionality to my program

I need a design pattern to provide undo functionality to my program. I've already used Memento, but I need another for my 开发者_Go百科coursework.


The command pattern is the classic pattern for an undo model.

basically encapsulate each action in an object (the command) and then make each command able to perform the reverse action. Keep a list of the commands as they are applied and to undo perform the reverse action on the list in reverse.

an example of using the command pattern for undo is here, although that was simply the first result from a google of 'command pattern for undo'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜