Answered by:
How to access private data from nested or proxy class

Question
-
I cant seem to access the private data from nested or proxy class. Could anyone point a direction? Thanks!Thursday, July 8, 2010 10:11 AM
Answers
-
A nested class has full access to all parts of the enclosing class. ISTR talking about this circa VC++ 2003, which did not permit it. To be fair, I'm pretty sure it was an addition to the original C++ Standard. Anyway, later versions do implement the feature. A class that is not nested would have to be made a friend.
Doug Harrison (Visual C++ MVP)- Proposed as answer by Yi Feng Li Wednesday, July 14, 2010 5:04 AM
- Marked as answer by Yi Feng Li Thursday, July 15, 2010 2:10 AM
Tuesday, July 13, 2010 2:01 AM -
IIRC allowing access from a nested class to enclosing-class members is new in C++0x, but many compilers, including VC++, started supporting it several years ago.
-cd [VC++ MVP] Mark the best replies as answers!- Proposed as answer by Yi Feng Li Wednesday, July 14, 2010 5:04 AM
- Marked as answer by Yi Feng Li Thursday, July 15, 2010 2:10 AM
Tuesday, July 13, 2010 2:04 AM
All replies
-
Hi etwc,
I’m confused about the nested ort proxy class you mentioned above. Can you give us more detail information about what you exactly want to do? If you get some problem with some special class, please provide some code sample, which will be helpful.
Cheers,
Yi
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.Monday, July 12, 2010 5:48 AM -
I cant seem to access the private data from nested or proxy class.
Maybe this discussion will help you:
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/ed63204a-2f81-43ef-8525-9a45450a68d2/
Monday, July 12, 2010 4:29 PM -
A nested class has full access to all parts of the enclosing class. ISTR talking about this circa VC++ 2003, which did not permit it. To be fair, I'm pretty sure it was an addition to the original C++ Standard. Anyway, later versions do implement the feature. A class that is not nested would have to be made a friend.
Doug Harrison (Visual C++ MVP)- Proposed as answer by Yi Feng Li Wednesday, July 14, 2010 5:04 AM
- Marked as answer by Yi Feng Li Thursday, July 15, 2010 2:10 AM
Tuesday, July 13, 2010 2:01 AM -
IIRC allowing access from a nested class to enclosing-class members is new in C++0x, but many compilers, including VC++, started supporting it several years ago.
-cd [VC++ MVP] Mark the best replies as answers!- Proposed as answer by Yi Feng Li Wednesday, July 14, 2010 5:04 AM
- Marked as answer by Yi Feng Li Thursday, July 15, 2010 2:10 AM
Tuesday, July 13, 2010 2:04 AM