Sorry for this stupid question, but I can't find an answer by myself, I'm too new in C++ :(
class DBObject : public QObject
{
...
protected:
virtual QString tableName() = 0;
};
class DBUserObject : public DBObject
{
...
protected:
virtual QString tableName() { return "profiles"; };
};
And I have this code in parent:
DBObject::DBObject(quint32 id)
: QObject(0)
{
...
if (id != 0)
load(id);
}
bool DBObject::load(quint32 id)
{
QString query = QString("select %1 from %2 where id = :id")
.arg(fieldList().join(","))
.arg(tableName()); <--- here is trouble
...
}
So I'm trying to execute:
DBUserObject user(3);
But in result I have a runtime error. Why not "profiles"?