JRR question #208: Can one object access a private variable of another object of the same class? Answer: Yes. Private means "private to the class" NOT "private to the object". So two objects of the same class could access each other's private data.
How should the objects do that: access each other's private data? I must be forgetting something. Greetings, Gian Franco
"Eppur si muove!"
Joined: Dec 20, 2001
Here's an example for you:
You can see, in line 1, we're directly accessing the private member of another object. This can be done because this code is executing within the definition of that class. Outside this class, it can't be done. I hope that helps, Corey