单例模式,最常用也最简单
class Base
{
private:
Base()
{
}
public:
static Base *Initiance()
{
if (m_pBase == NULL)
{
m_pBase = new Base();
}
return m_pBase;
}
virtual ~Base()
{
}
void display()
{
cout<<"Base Class"<<endl;
}
static Base *m_pBase;
};
Base *Base::m_pBase = NULL;