Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: All
May 21, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Emergency Exit

This is a trick you should never, ever apply, unless it is your last chance to meet the deadline for the presentation which will save your job:
  #define private public
  #define protected public
  #define class struct

I am sure, even if you never have seen this trick before, you immediately realize what it does: It silently breaks the whole encapsulation system of C++. You can access all internals of the class definitions in the included header files. This is an emergency exit; it is definitely not a reasonable method to overcome the problems caused by bad design choices. However, it is still better than other "tricks" based on dirty conversions, which I have seen in existing code.
Karsten Weihe
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date