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

find object in heap??

 
jacob deiter
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Here, class B has the reference of class a.all object exist in Heap Memory.So if find the object B in heap then is it possible to find reference variable A then class a instance?
 
Campbell Ritchie
Sheriff
Posts: 48424
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Since you haven't given "A" private access (as you ought) you can find the "A" reference from an instance of class b easily.
 
jacob deiter
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If can you give some pseudo code ?
 
Campbell Ritchie
Sheriff
Posts: 48424
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you really not work that out for yourself?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic