2010/11/7 denilsson31 <denilsson31@xxxxxxxxxx>: > QFile is defined like this: > > class QFile { > [...] > > public; > [...] > > virtual void close(); > > [...] > }; > > dbFile is an interface in sense of Java or pure virtual class if you prefer > and is defined like this : > > class dbFile { > > public: > > [...] > virtual int close() = 0; > > [...] > }; > > So, TemporaryDbFile has the duty to implement dbFile's interface with > QTemporaryFile (derivated from QFile) : > > class TemporaryDbFile :public QTemporaryFile, public dbFile > { > [...] > > 42: int close() > 44: { > 45: QTemporaryFile::close(); > 46: return dbFile::ok; > 47: } > > [...] > } > > But in this nice picture, there is a sand grain : the gcc compiler 4.4.0. > He tells, mockingly : > > TemporaryDbFile.h:42:error: conflicting return type specified for 'virtual > int TemporaryDbFile::close()' > C:\Qt\2010.03\qt\include\QtCore\..\..\src\corelib\io\qfile.h:148:error: > overriding 'virtual void QFile::close()' > > Have you some tricks for me ? You can override dbFile::close() in an intermediate class: class dbFileWrapper : public dbFile { protected: virtual void doClose() = 0; int close() { doClose(); return dbFile::ok; } }; class TemporaryDbFile : public QTemporaryFile, public dbFileWrapper { void doClose() { QTemporaryFile::close(); } }; Hope this helps. Dario