Originally posted by Joe Nguyen:
Let forget about class perspective for a moment and discuss about general OO practice.
Suppose there is a class Person and let create two instances of the class Person. One is John and the other is Michelle. It would not be right to let John directly modifies Michelle's favorite sport without letting michelle knows (assume favoriteSport is a private variable of class Person).
As long as direct access to private variable is permitted, the other object does not need/want to invoke getter/setter method.
Originally posted by Randy Nichols:
But wouldn't that also be a reason for wanting it to NOT be visible, so I could put "setter" and "getter" methods on the object where I'd put the notify code, and make sure others don't access the private members without my knowing?
But cant get it to work quite right, i think i might need a set or sortedset, but i cant figure out how to correctly put in primatives and then get them out etc.