创建型模型
0 人感兴趣 · 2 次引用
- 最新
- 推荐

创建型模式之单例模式和工厂模式
定义:Ensure a class has only one instance, and provide a global point of access to it.(确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例。)饿汉模式:(在单例类定义的时候(即在main函数之前)就进行实例化,是线程安全的)

0 人感兴趣 · 2 次引用
定义:Ensure a class has only one instance, and provide a global point of access to it.(确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例。)饿汉模式:(在单例类定义的时候(即在main函数之前)就进行实例化,是线程安全的)