caretaker.java

来自「《深入浅出设计模式》的完整源代码」· Java 代码 · 共 41 行

JAVA
41
字号
package memento;public class caretaker{ /**  * This class manages memento objects.  * @version 1.0, 10/25/2002  * @author		Ryan O'Malley  */ /**  * This variable stores the memento object.  */  private memento my_memento; /**  * The class constructor.  Sets the my_memento attribute to null;  */  public void caretaker(){    this.my_memento = null;  } /**  * This method sets(stores) the memento attribute.  * @param The memento object to be stored.  */  public void set_memento(memento in_memento){    this.my_memento = in_memento;  } /**  * This method returns the memento attribute.  * @return The stored memento object.  */  public memento get_memento(){    return this.my_memento;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?