[Qt-interest] QFile private member

Andreas Pakulat apaku at gmx.de
Tue Feb 10 22:31:51 CET 2009


On 10.02.09 12:35:02, Stanislas Polu wrote:
> Indeed, the constructor is private... therefore
> PrivateFile::PrivateFile(const QString &fileName)
>        : file(QFile(fileName))
> {
> }
> 
> won't work either...
> 
> I have to agree with Andy, you can keep track of a pointer to a QFile rather
> than the QFile itself.

Or just use the constructor that takes a const QString:

PrivateFile::PrivateFile( const QString& f )
: file( f )

if file is declared as "QFile file;".

BTW: All this has nothing to do with Qt, its plain C++.

Andreas

-- 
Make a wish, it might come true.



More information about the Qt-interest-old mailing list