I am using Qt5 on a Windows 7 platform.
I've implemented a Singleton for a database I work with.
So far it's ok, it works fine, but when I compile the code I always get 2 warnings related to copy constructor and to assignment operator.
Here is the code:
class DataBase : public QObject
{
Q_OBJECT
public:
static DataBase * instance(QObject * parent = 0);
static void destroy();
//
QString openDataBaseConnection();
void closeDataBaseConnection(QString & connectionName);
private:
DataBase(QObject * parent);
~DataBase();
DataBase(DataBase const &){} // <- copy constructor
DataBase & operator = (DataBase const &){} // <- assignment operator
static DataBase * pInstance;
};
And here are the compiler warnings:
1) Base class QObject should be explicitly initialized in the copy constructor
2) No return statement in function returning non-void (that's for the assignment operator code line).
Well, what can I do in order to finally get rid of these 2 warnings?