Nov-07-2018, 12:57 PM
Dear all,
I want to create series of objects belonging a class and keep all these objects in a list (say a population of people). I thought of maintaining the list because I need to iterate through the objects many times and match some of their attributes (search based on age or something else).
But then I realized that when I want to delete one of those objects (a person dies or opts out), just removing it from the list is not enough because even after that an instance of the object seem to exist outside the list. So I have to both remove it from the list and delete the instance that exists outside. Is there a better way to do this?
Thank you
I want to create series of objects belonging a class and keep all these objects in a list (say a population of people). I thought of maintaining the list because I need to iterate through the objects many times and match some of their attributes (search based on age or something else).
But then I realized that when I want to delete one of those objects (a person dies or opts out), just removing it from the list is not enough because even after that an instance of the object seem to exist outside the list. So I have to both remove it from the list and delete the instance that exists outside. Is there a better way to do this?
Thank you