|
-
September 7th, 2008, 09:10 AM
#11
Re: private members not so private.
 Originally Posted by Peter_APIIT
What is conclusion about this topic ? Why this will happen ?
The conclusion is that C++ will not keep you from shooting yourself in the foot if you are hell-bent on doing so. Compiler rules exist to keep sane programmers from making mistakes, not to keep insane programmers from deliberately breaking them. I think Graham hit the nail on the head with this earlier.
It is worth mentioning that unions may not contain non-POD types, so this "method" of accessing private data doesn't apply to the vast majority of classes. You can still use pointers to access the data, but that's not the point. The point is don't do it.
- Alon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|