[Development] fixing name of QNetworkAccessManager::createRequest

Thiago Macieira thiago.macieira at intel.com
Mon Jan 16 01:50:35 CET 2012


On Sunday, 15 de January de 2012 20.25.17, Peter Kuemmel wrote:
> Technically interesting here is the question how such a
> situation cloud be managed? Using C++11 'final' would
> prevent the reimplementation. But using pre C++11, the only 
> idea I have is to define a dummy function with a different
> return value, only this why the compiler would complain.

Actually, this *is* a solution. If we change the return value of the virtual 
createRequest to int and keep the arguments, someone trying to override it 
with the standard function would get a compiler error:

<stdin>:1:224: error: conflicting return type specified for ‘virtual 
QNetworkReply* Derived::createRequest(QNetworkAccessManager::Operation, const 
QNetworkRequest&, QIODevice*)’
<stdin>:1:105: error:   overriding ‘virtual int 
QNetworkAccessManager::createRequest(QNetworkAccessManager::Operation, const 
QNetworkRequest&, QIODevice*)’

We can use a return type like 
ThisFunctionIsDeprecated_InsteadPleaseOverride_createReply.

That said, I don't think it's worth it. Just leave it alone.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120115/322876d6/attachment.sig>


More information about the Development mailing list