Create class from string in c++ to avoid large switch statement?
I am refactoring a C++ application to make better use of polymorphism. I
have a large factory method that instantiates the proper object based on
an Enum. Rather than have a large switch statement, is there a way to have
a lookup table that maps from the values of the Enum to classes that I
could then use to create the proper object?
No comments:
Post a Comment