Ruby is one of the very few languages that have the kind of "object-based protection" you're imagining. Smalltalk, C++, and (I think, can someone confirm?) Python all do things the same way as Java does.
Thanks for the link to the explanation Marc. I guess not exposing the existence of private member variables by having to provide public get methods is a point.
Joined: Feb 18, 2005
And let me add that my Java course instructor didn't know the answer to this one. Thank you all very much for your instructive and nearly instantaneous replies. This was my first posting on this board and the experience couldn't have been more positive.
so, yes, Python works like Java in this respect, by default. but that's really not surprising, since Python doesn't have any strictly enforced analog of "private", at all; you can always override a Python class' access restrictions if you really want to.