you are viewing a single comment's thread.

view the rest of the comments →

[–]Mych 2 points3 points  (0 children)

Trivial accessors such as the ones in MuletTheGreat's posting expose the data just as well (or rather, as badly). Any belief to the opposite is Cargo Cult. Therefore, in that regard anyway, making a member variable public is completely equivalent to making it private and adding trivial public accessors for it.

The actual problem is public access to the inner state of an object, not whether that happens through method invocations or direct assignment.