In article 
<[EMAIL PROTECTED]>,
 "Russ P." <[EMAIL PROTECTED]> wrote:
 
> In C++ (and
> Java?), on the other hand, the "protected" keyword *really* prevents
> the client from accessing the data or method, but it allows access to
> derived classes. The "private" keyword goes further and prevents
> access even by derived classes.

In C++, it does no such thing.  Consider this class declaration in 
MySecretClass.h:

class MySecretClass {
private:
   int foo;
};

All somebody has to do to get at the private data is:

#define private public
# include <MySecretClass.h>
#undef private

If playing preprocessor games isn't your thing, there's a whole multitude 
of other tricks you can play with pointers and typecasts that will get you 
access to foo in other ways.

But, you protest, you're not supposed to do that!  Well, of course not.  
But you're not supposed to ignore the leading underscore convention in 
Python either.  That's the nice thing about freedom of religion; you get to 
pick which particular sins you want to get freaked out about.

I'm pretty weak on Java, but my understanding is that it's in better shape 
here, since it has neither textual inclusion of header files, nor pointers.  
You might have to resort to JNI :-)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to