【发布时间】:2011-04-27 04:18:18
【问题描述】:
class TsDatabasePool
{
private:
TsDatabasePool(int numDBConn, std::string& DBName, std::string& DBType);
static TsDatabasePool* objInst_;
public:
~TsDatabasePool();
QSqlDatabase* borrowFromPool();
void returnToPool(QSqlDatabase*);
static bool createInstance(std::string& DBName, std::string& DBType);
static TsDatabasePool* getInstance();
};
我的析构函数没有被隐式调用。使用的对象实例 objInst_ 在私有构造函数中分配。我不想在任何现有函数中调用析构函数或调用 delete objInst_。谁能告诉我该怎么办
【问题讨论】:
标签: c++ singleton destructor