gcc -Woverloaded-virtual

David Faure faure at kde.org
Sun Nov 25 16:25:38 GMT 2007

On Saturday 24 November 2007, Aurélien Gâteau wrote:
> class KIO::Job : public KCompositeJob {
> public:
>     virtual void addSubjob(Job*, bool inheritData); /* <- no more default */
>     void addSubjob(Job* job) { addSubjob(job, true); }
> private:
>     using KCompositeJob::addSubjob;
> };

> Note that the "using" line is still necessary because even without the
> overloaded parameter, the signatures of the two methods are still
> different: KCompositeJob::addSubjob() accepts a KJob* while
> KIO::Job::addSubjob() takes a KIO::Job* (this one had me confused for a
> while).

I fixed the slotInfoMessage warning a better way (moving the slot to the
private class since it's unrelated to the one in the base class; I'll commit tomorrow),
but I didn't have a fix for addSubjob/removeSubjob so I'm glad you raise this.
Your post made me realize the argument-type difference... the fact that addSubjob 
takes a KIO::Job and removeSubjob takes a KJob is quite illogical.
I would use KJob for both (since it's virtual anyway) and I would handle 
that correctly in the code (calling the KJob:: methods and not doing the
KIO-specific stuff). I.e. allowing normal KJobs as children of KIO::Jobs instead
of half-forbidding like now. Can you make that change?

David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

More information about the kde-core-devel mailing list