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.

See also  Does It Make Sense to Splurge on a Laptop?

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist