[C++]: Multiple inheritage/Conflicts

Dario Saccavino kathoum@gmail.com
Sun Nov 7 23:16:00 GMT 2010


2010/11/7 denilsson31 <denilsson31@hotmail.fr>:
>
> Thanks for giving your time, Dario.
>
> It seems it can't since 'int close()' should be public.
>
> Could it be a gcc's bug ?
>

I don't have the Qt sdk at hand, but the following test code works for
me (with gcc 4.3.2):

========
class QFile {
    public:
        virtual void close();
};

class QTemporaryFile : public QFile {
};

class dbFile {
    public:
        virtual int close() = 0;
        static int ok;
};

class dbFileWrapper : public dbFile
{
    private:
        virtual void doClose() = 0;
        int close()
        {
            doClose();
            return dbFile::ok;
        }
};

class TemporaryDbFile : public QTemporaryFile, public dbFileWrapper
{
    private:
        void doClose()
        {
            QTemporaryFile::close();
        }
};
========

   Dario



More information about the Gcc-help mailing list