![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Design Patterns
蜗窝牛快快爬
这个作者很懒,什么都没留下…
展开
-
设计模式一之单例模式
意图:一个类有一个实例,并提供一个他的全局访问点特点:1、该类不能被外界任意实例化2、该类向外界提供一个可获得该类实例的方法3、该类只能被实例化一次例子:只给司机一辆摩托车package Singleton;class Moto { static Moto m=null;private Moto(){}static Moto GetInstance(){原创 2017-04-28 20:30:13 · 207 阅读 · 0 评论 -
设计模式二之工厂方法
意图: 1、Define an interface for creating an object,but let the clesses that implement the interface decide which class to instantiate. 2、The factory method lets a class defer instantiation to subclass原创 2017-04-28 21:45:56 · 208 阅读 · 0 评论 -
设计模式三之备忘录模式
package memento;public class Boy { String myState;}package memento;public class XiaoMing { /** * @param args */ public static void main(String[] args) { Boy boy=new Boy();原创 2017-05-21 14:21:29 · 259 阅读 · 0 评论