This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/doric/template/singleton.h

29 lines
394 B
C
Raw Normal View History

2019-12-04 15:51:46 +08:00
#ifndef SINGLETON_H
#define SINGLETON_H
#include <QDebug>
class Singleton
{
private:
static Singleton *local_instance;
2021-01-28 17:06:40 +08:00
Singleton()
{
2019-12-04 15:51:46 +08:00
qDebug() << "constructor";
}
2021-01-28 17:06:40 +08:00
~Singleton()
{
2019-12-04 15:51:46 +08:00
qDebug() << "destructor";
}
public:
2021-01-28 17:06:40 +08:00
static Singleton *getInstance()
{
2019-12-04 15:51:46 +08:00
static Singleton locla_s;
return &locla_s;
}
};
#endif // SINGLETON_H