Heya.
I have a class in which part of the responsibilities of one of the members is to return an object of a specific type.
Now I can't guarentee that I am going to know where these objects are going to end up and I don't want to end up with a memory leak.
What do most people do when faced with this situation. Do you declare a static object and return a reference to it, do you allocate memory for it and ensure you clean up later, or do you prefer to return copies of the object (or do you not get in a situation where you don't know whether you are going to be able to clean up the objects later!)?
The reason I ask is I am currently faced with a design decision in my project, and while this is a very open ended question, I am hoping to get some idea as to how others treat this kind of problem.
Cheers