[Qt-interest] QFile private member
andrew.m.goth at l-3com.com
andrew.m.goth at l-3com.com
Tue Feb 10 21:24:05 CET 2009
Pete Christensen wrote:
> OK, I give up, I can not do this. How do I declare a private member
> variable of type QFile and initialize it in the constructor?
Are you sure you want QFile and not QFile*?
> Compiler complains:
> /usr/include/qt4/QtCore/qfile.h:191: error:
> 'QFile::QFile(const QFile&)'
> is private
The gripe is against the header file, not the implementation of the
constructor. Specifically the complaint is that the QFile copy
constructor is private. Why would that be a problem? It looks to me
that it's trying to make a default copy constructor for your class, but
it can't since it would rely on copy constructors for all data members
of your class. You could explicitly define a copy constructor for your
class, or you could just switch to QFile*, which can be copied without
incident.
--
Andy Goth
<amgoth at link.com>
More information about the Qt-interest-old
mailing list