oop - Can abstract factory be used for something other than creation -
i have abstract factory class keeps map of types (application specific types integers) , pointers factory objects. map initialized in constructor of abstract factory has method called ifactory* get_factory_for_type(int)
. ifactory
interface factory classes must inherit from.
i need string representing of objects each factory can produce , list of available object types.
if add map in abstract factory (of type std::map<int, std::string>
) , 2 methods std::string get_name_for_type(int)
, std::vector<std::string> get_type_names()
, way it?
i wary of doing though abstract factory should responsible creating object factories. there better way or okay in abstract factory?
the purpose of abstract factory ability create specific set of objects, adapted environment. school book example windows/linux/mac etc, more relevant example different persistence options.
as types factory creates should known, don't see reason have sort of enumeration of objects objects should remain same different environments.
that said, no 1 says have follow patterns blindly. though recommend document deviation , explain purpose of it.
Comments
Post a Comment