How to delete an object that has more than one references?

Hi,

I have two diffrent lists which they hold refenrences to same object.

The problem is;

I couldn't figured out what should I do when I delete the object in the first list? I mean second list's references will become dangling arent't they?

How can I set NULL or remove the regarding object in the second list?

King regards.
Last edited on
You have to remove them both, i guess.
Yes but once I deleted from the first list, how can I get the object from second one?

I think list deletion deletes reference of the object..
It's a two step process. You have to remove the list and you have to delete the object.

If you know that you entries in two lists that point to an object that you need removed, you remove the pointer from the two lists and release the pointer once. The order you do this in doesn't really matter.
Topic archived. No new replies allowed.