[Qt-interest] QWizardPage::wizard() overprotected?

Thiago Macieira thiago.macieira at trolltech.com
Thu Dec 11 13:11:57 CET 2008


On Thursday 11 December 2008 12:09:06 Oliver.Knoll at comit.ch wrote:
> // muahahahahaaa (*evil laughter*)
> #define private public
> #define protected public
> #include "TheClassToWhichYouWantToHaveAccessToTheHiddenMembers.h"
>
> void ReallyEvilAndBadClass::doNastyStuff() {
>    TheClassToWhichYouWantToHaveAccessToTheHiddenMembers unlockedClass;
>
>    unlockedClass.callWhateverYouWant();
>    ...
> }
>
> Don't blame me when you shoot yourself into your knee (and blow away your
> entire body). Isn't C++ nice?

Hello

Just point out: this trick doesn't work with Microsoft Visual Studio 
compilers, since the protection is encoded in the function's mangled name. So 
you'll only succeed in getting a linker error due to an undefined symbol.


-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Software Engineer - Nokia, Qt Software
  Qt Software is hiring - ask me
      Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081211/0bb70093/attachment.bin 


More information about the Qt-interest-old mailing list