#include
using namespace std;
template
class CSingleton {
public:
static T* instance();
static T _instance;
};
template
T CSingleton
template
T* CSingleton
{
return &_instance;
}
class CTest
{
public:
CTest()
{
cout << "Construct" << endl;
};
~CTest()
{
cout << "Destruct" << endl;
};
};
typedef CSingleton
void test()
{
CSingleTest::instance();
}
int main()
{
cout << "Begin of main" << endl;
cout << "End of main" << endl;
return 0;
}
What’s the output?
近期评论