Emergency Exit

Emergency Exit

This is a trick you should never, ever apply, unless it is your lastchance to meet the deadline for the presentation which will save yourjob:

   #define private public  #define protected public  #define class struct  #include...

I am sure, even if you never have seen this trick before, youimmediately realize what it does: It silently breaks the wholeencapsulation system of C++. You can access all internals of theclass definitions in the included header files. This is an emergencyexit; it is definitely not a reasonable method to overcome theproblems caused by bad design choices. However, it is still betterthan other “tricks” based on dirty conversions, which I have seen inexisting code.


Share the Post: