
Design Patterns
蜗窝牛快快爬
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
设计模式一之单例模式
意图:一个类有一个实例,并提供一个他的全局访问点 特点: 1、该类不能被外界任意实例化 2、该类向外界提供一个可获得该类实例的方法 3、该类只能被实例化一次 例子:只给司机一辆摩托车 package Singleton; class Moto { static Moto m=null; private Moto(){ } static Moto GetInstance(){原创 2017-04-28 20:30:13 · 235 阅读 · 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 · 247 阅读 · 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 · 300 阅读 · 0 评论