[设计模式]Singleton

Posted by JayXie

Singleton通过static关键字和protected的构造函数来确保实例的唯一性。用Static来修饰存储实例的指针,用Static来修饰访问实例的函数,用protected来修饰构造函数。

Leave a Reply