设计模式
  • 简介
    • 生成器(Builder)
    • 工厂 (Factory )
    • 原型 (Prototype)
    • 简单工厂(Simple Factory)
    • 单例模式(Singleton pattern)
    • 适配器(Adapter)
    • 桥接模式 (Bridge)
    • 组合(Composite)
    • 装饰器(Decorator)
    • 外观 (Facade)
    • 享元(Flyweight)
    • 代理(Proxy)
    • 责任链(Chain Of Responsibility)
    • 模板方法(Template Method)
    • 命令模式(Command)
    • 解释器(Interpreter)
    • 迭代器(Iterator)
    • 中介者(Mediator)
    • 备忘录(Memento)
    • 观察者(Observer)
    • 状态(State)
    • 策略(Strategy)
    • 访问者(Visitor)
  • 联系我 ↗ (opens in a new tab)
反馈或交流请加 微信 并注明来意
(opens in a new tab)
skills
design-mode
行为型
备忘录(Memento)

备忘录(Memento)

当你需要让对象返回之前的状态时(例如, 你的用户请求"撤销"), 你使用备忘录模式。

文本编辑器基本都支持这一模式

中介者(Mediator)观察者(Observer)