class Huis{ smartQuery sq;public: void helo();};void Huis::helo(){ smartQuery sq2; sq.addKey("k"); sq.addKey("value"); sq.select("org"); while (sq.next()) qDebug() << sq.value(1).toString();}int main(int argc, char ** argv){... Huis h; h.helo(); // это работает Huis *x; x->helo(); // это нет...}
int main(int argc, char ** argv){... Huis h; h.helo(); Huis *x = new Huis; x->helo();...}
Huis *x = new Huis;
Huis *x;x = new Huis;
int main(int argc, char ** argv){... Huis *x; x->helo(); // это нет...}
3 smartQuery::smartQuery ( QSqlResult * result ) : QSqlQuery(result) 4 { 5 dbg.sql("Constructor by result"); 6 } 7 smartQuery::smartQuery ( const QString &str, QSqlDatabase db ) : QSqlQuery(str, db) 8 { 9 dbg.sql("Constructor by string and database"); 10 } 11 smartQuery::smartQuery ( QSqlDatabase db ) : QSqlQuery(db) 12 { 13 dbg.sql("Constructor by database"); 14 } 15 smartQuery::smartQuery ( const QSqlQuery & q ) : QSqlQuery(q) 16 { 17 dbg.sql("Constructor by query"); 18 *this = (const smartQuery&)q; 19 } 20 smartQuery::smartQuery (const smartQuery & q) 21 { 22 dbg.sql("Constructor by smartQuery"); 23 *this = q; 24 } 25 26 smartQuery& smartQuery::operator= ( const smartQuery& q) 27 { 28 dbg.sql("operator = smartQuery"); 29 query = q.query; 30 order = q.order; 31 keys = q.keys; 32 values = q.values; 33 *((QSqlQuery*)this) = (const QSqlQuery&)q; 34 return *this; 35 } 36 37 smartQuery::~smartQuery() 38 { 39 dbg.sql("destructor"); 40 }
Constructor by string and database