小熊_0001
2014-05-31 23:05
单例模式(懒汉式) 1. 将构造方法私有化, 不允许外边直接创建对象 2. 声明类的唯一实例, 使用private static修饰 3. 提供一个用于获取实例的方法, 使用public static修饰
This is one of the most simple way.We can also use enum class or inner calss to implement this pattern.
enen
模式的秘密---单例模式
74387 学习 · 108 问题
相似问题