设计模式之原型模式 Prototype

设计模式之原型模式 Prototype

public class Sheep implements Cloneable,Serializable{
    
    private String sname;
    private Date birthday;
    
    @Override
    protected Object clone() throws CloneNotSupportedException {
        Object obj = super.clone();    
        return obj;
    }

    public Sheep(String sname, Date birthday) {
        super();
        this.sname = sname;
        this.birthday = birthday;
    }

    public String getSname() {
        return sname;
    }

    public void setSname(String sname) {
        this.sname = sname;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    
}
sheep类

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-12-31
  • 2021-10-16
  • 2021-06-13
  • 2021-08-09
  • 2021-06-21
猜你喜欢
  • 2021-07-26
  • 2022-02-23
  • 2021-12-26
  • 2021-11-20
  • 2021-10-06
相关资源
相似解决方案