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

Reference or just a copy?

 
David Duran
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I do a get out of a hashtable and modify a member variable of the returned object, will that modification be mirrored in the hashtable or do I have to do a 'put' again?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The hashtable returns a reference to the original object, not a copy - so it's been modified now. No need for a put.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic