Ok, first off, I'm probably using wildly inaccurate terminology in the subject line.
Let's say I have a class called Office, and classes that work with it called Chair, Desk, and Table, such that, in bad pseudocode:
Now, in the program there may be several instances of Office.
Let's say I've got some code in my Desk class that needs to find out something about the Chair that is in the same Office instance. How do I get a reference to the particular instance of Office that the Desk is in?
I have a feeling this is something fairly trivial, but I can't recall how to do this, if it can be done.
Have a member field that is a reference to its parent, and set it in the constructor: Of course, you could perhaps use setOffice(Office o) or moveTo(Office o) methods to change the office member.
Of course, it would be best to have some interface or abstract base class for Office, let's say Space, so you can move chairs etc to different kinds of spaces (office, bedroom, etc) without much code change. And you can do the same for Chair, Table, etc. If you make that an abstract class (called Furniture) you can put the moving code into that one abstract base class.