Question regarding factory pattern

Posted by eriks on Stack Overflow See other posts from Stack Overflow or by eriks
Published on 2010-03-13T12:37:01Z Indexed on 2010/03/13 12:45 UTC
Read the original article Hit count: 405

I have a factory class to build objects of base class B. The object (D) that uses this factory received a list of strings representing the actual types. What is the correct implementation:

  1. the factory receives an Enum (and uses switch inside the Create function) and D is responsible to convert the string to Enum.
  2. the factory receives a string and checks for a match to a set of valid strings (using ifs')
  3. other implementation i didn't think of.

© Stack Overflow or respective owner

Related posts about c++

Related posts about design