Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

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

  #include...
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.

 

 

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