M
Matt B
Subject is probably poorly worded, but bear with me as I describe the
situation that has me puzzled.
I create "Save" objects from a Save "factory" class. Many different
windows access this method to get their save object. I do this
because I am interested from the save factory when any of the many
windows uses that save object. I keep these save objects in a list in
the factory class that is iterated through when any one of them
saves.
My problem is that now, I need to know when it will no longer be used
by the window that requested the save object (the window is closed,
for example), so that I can remove it from the list and destroy it.
The only thing I could come up with is that in each window, on
closing, I would call a method on that save object that would let the
factory class know that I am done with it. But that seems like a bad
idea. I'm really not sure how else to make this happen. Is this just
poor design?
situation that has me puzzled.
I create "Save" objects from a Save "factory" class. Many different
windows access this method to get their save object. I do this
because I am interested from the save factory when any of the many
windows uses that save object. I keep these save objects in a list in
the factory class that is iterated through when any one of them
saves.
My problem is that now, I need to know when it will no longer be used
by the window that requested the save object (the window is closed,
for example), so that I can remove it from the list and destroy it.
The only thing I could come up with is that in each window, on
closing, I would call a method on that save object that would let the
factory class know that I am done with it. But that seems like a bad
idea. I'm really not sure how else to make this happen. Is this just
poor design?