N
nooneinparticular314159
I want to allow a parent objects and its child to communicate.
Sending messages to the child is easy, since I can simply write to
that child's methods. But the child needs to send messages back to
the parent, and not necessarily when the parent is able to poll the
child. (In fact, almost certainly not when the parent is able to poll
the child.) How can I pass the parent to the child so that the child
can send messages back to the parent?
Also, if I do this, will I ever be able to garbage collect the
parent? At some point, I will want to eliminate the parent and its
children. But the child will have a reference to the parent, and the
parent will have a reference to the child. So will they ever get
marked for garbage collection?
Thanks!
Sending messages to the child is easy, since I can simply write to
that child's methods. But the child needs to send messages back to
the parent, and not necessarily when the parent is able to poll the
child. (In fact, almost certainly not when the parent is able to poll
the child.) How can I pass the parent to the child so that the child
can send messages back to the parent?
Also, if I do this, will I ever be able to garbage collect the
parent? At some point, I will want to eliminate the parent and its
children. But the child will have a reference to the parent, and the
parent will have a reference to the child. So will they ever get
marked for garbage collection?
Thanks!