If you intend there to be only one Tahede instance in your program, please look at the singleton pattern. If you want to have a delayed construction of a member variable, you need to initialize it to 0 first. Perhaps the following would work (might not compile verbatim, inline code for a brief example):
{
public:
MyObject() : _tahede(0) {}
void doExec() {
tahede()->exec();
}
protected:
Tahede* tahede() {
if(!_tahede)
_tahede = new Tahede(this);
return _tahede;
}
private:
Tadede* _tahede;
};
class MyObject : public QObject
{
public:
MyObject() : _tahede(0) {}
void doExec() {
tahede()->exec();
}
protected:
Tahede* tahede() {
if(!_tahede)
_tahede = new Tahede(this);
return _tahede;
}
private:
Tadede* _tahede;
};
To copy to clipboard, switch view to plain text mode
Bookmarks