[Qt-interest] Library binary compatibility issue

Thiago Macieira thiago at kde.org
Fri May 21 18:43:06 CEST 2010


Em Sexta-feira 21 Maio 2010, às 14:27:20, Giacomo S. escreveu:
>  I thought that reimplementing a virtual method declaring its
> implementation as non virtual would have removed the virtual
> behaviour...

Once virtual, it's virtual forever. So the "virtual" keyword is optional in 
overriding. 

But if you get the method signature wrong, instead of overriding, it simply 
shadows the original virtual method. This is something that C# got right and 
the original C++ didn't, but C++0x allows for fixing.

That is, when you write a virtual function, you declare whether it's a new 
virtual, or whether you're overriding a virtual. Then the compiler can tell 
you when you think you're declaring a new one but you're actually overriding, 
or when you think you're overriding but you're not.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100521/16369754/attachment.bin 


More information about the Qt-interest-old mailing list