On Jun 5, 12:20 pm, Roy Smith <[EMAIL PROTECTED]> wrote:

> All somebody has to do to get at the private data is:
>
> #define private public
> # include <MySecretClass.h>
> #undef private

Well, that shows the weakness of the C/C++ header files. The "include"
directive merely does a simple text substitution, which is pretty lame
as far as I am concerned. As you say, Java has moved beyond that, and
Ada has always been more sophisticated than that.

By the way, my recollection is that in C++ access defaults to private
if nothing is declared explicity. So normally the "private"
declaration is unnecessary. If it is left out, your little trick won't
work. But your point is still valid.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to