Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • I don't understand what Factory is doing. It looks like it's returning a local variable. Is that object valid? Commented Nov 3, 2010 at 17:24
  • 4
    @John: it's returning a copy of a local object. The return is by value, so it doesn't matter whether the original dies afterwards (and of course, it does). Nothing wrong with that, other than that it's not appropriate for a factory function... Commented Nov 3, 2010 at 17:26
  • Yeah the GetThing method on the Factory class is returning a local variable. Which apparently won't do what I want. I should be using pointers instead. At least according to the answers below. Commented Nov 3, 2010 at 17:28