[Qt-interest] Library binary compatibility issue

Esben Mose Hansen kde at mosehansen.dk
Fri May 21 12:29:37 CEST 2010


On Friday 21 May 2010 10:12:11 Giacomo S. wrote:
> A question about binary compatibility issue in a library of mine:

When you override a virtual function, the function itself is virtual. E.g, the 
attached program outputs

        C       B       A
A       1       2       3                                                                                                                                                                     
B       2       3                                                                                                                                                                             
C       3                                                                                                                                                                                     

If B::foo() had been non-virtual, the middle (which is a object of type C 
accessed through a pointer to type B) should have returned 2, not 3.

Thus, the function you want to make virtual is already virtual, if I 
understand you correctly.

Wish I had to time to dig it out of the standard :)


-- 
kind regards, Esben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test2.cpp
Type: text/x-c++src
Size: 599 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100521/12b5586b/attachment.bin 


More information about the Qt-interest-old mailing list