class A
{
private:
A();
~A();
static A* m_pA = NULL;
public:
A* getSingA()
{
if (m_pA == NULL)
m_pA = new A();
return m_pA;
};
}
单例模式是工厂模式的一种,运用很广泛
class A
{
private:
A();
~A();
static A* m_pA = NULL;
public:
A* getSingA()
{
if (m_pA == NULL)
m_pA = new A();
return m_pA;
};
}