문제

Possible Duplicate:
Accessing private members
Is it possible to access private members of a class?

Is there a good (yes I know this is ugly) way to hack to the private data members of a class?

One brute force approach is to copy the header file and in my copy change private to public. But would there be a better way, say doing

#define private public

or something else?

도움이 되었습니까?

해결책

There are lots and lots of ways of doing this - all of them bad. Protection in C++ is there for a purpose, to prevent you from making mistakes. It is not there as a security measure. If you want public access, just make things public!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top