[Qt-interest] QFile private member

Paul Floyd paulf at free.fr
Wed Feb 11 09:39:07 CET 2009


Quoting andrew.m.goth at l-3com.com:
Hi


>
> Constructor (approach #1):
>
> MyClass::MyClass(QObject* parent):
>     QObject(parent),
>     file(new QFile(this))
> {}

If you are into exception safety, then you can do this in the rather groovy (for
something related to exceptions at least) way

MyClass::MyClass(QObject* parent) try :
     QObject(parent),
     file(new QFile(this)
{}
catch (...) // or at least std::exception
{}

A+
Paul



More information about the Qt-interest-old mailing list