I understand that, for classes, private members can only be accessed by public members. But does that apply for each discrete instance of a class or can the public member of one instance directly access the private member of another instance.
For example, say there are two instances of class: instance1 and instance2. And say that the class has a private member x and public members getX() and setX(). If I want to set instance1.x equal to instance2.x which if the following would be correct:
instance1.setX(instance2.x)
Or
instance1.setX(instance2.getX())