4.工厂模式
就是把简单工厂模式,再抽象出来个接口,然后每个方法对象一个工厂类.
这样的好处就是,不用在工厂类里new对象,对修改关闭.可以通过反射来创建新的对象,对扩展开放.
5.原型模式
就是一个类提供clone方法(可以实现IConleable),利用this.MemberwiseClone()实现浅复制(就是引用对象还是跟之前对象的引用对象地址是一样的),如果要实现深复制,那么每个引用对象还要再实现一个浅复制,最后在类的clone方法里逐个给对象赋值.