Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Roundup #208

 
Gil Salu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could someone clearify #208?
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You know, I didn't memorize that one.
 
Paul Caudle
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think perhaps this question might fit well in the Java Ranch forum or maybe we could just get one of the Sheriffs to clarify what #208 is...or we can run the game until we get it...that's what I think I'll do in the meantime.
Paul
 
Paul Caudle
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can one object access a private variable of another object of the same class?
<h6>it only took me about 2 minutes to find it...but I got a lot of the questions wrong in the meantime</h6>
The answer to this question is Yes, it can. I think the explanation of this answer in the round-up is that the access is granted to the class, not the object...
To explain that a little further, any object created from a specific class has access to the private variables of any other object created from that class.
Take a look:

Even though there are 2 different objects here (referenced using x and b) b is still able to access the private variable of object x. Why? Because the objects referenced by x and b were both created from the same class (Sharing), and objects created from the same class have access to each other's privates ( get your mind out of the gutter, you know what I mean!).
I hope that helps...send me an e-mail if you want a little clarification and I'll post it up here.


[This message has been edited by Paul Caudle (edited November 13, 2000).]
 
Gil Salu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all...after I re-read the question I understood what it was talking about...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic