1、
在头文件中
main_class
{
public:
//单例 static main_class *get_instance() { static main_class *m_pInstance = NULL; if (m_pInstance == NULL) { m_pInstance = new main_class(); } return m_pInstance; }}
使用:
main_class *main_class_ = main_class::get_instance();