Skip to content
Advertisement

Tag: factory

How to implement a factory class?

I want to be able to create objects based on an enumeration class, and use a dictionary. Something like this: But I get the error: For some reason the dictionary can’t be created. Where am I going wrong here? Answer After looking at Bruce Eckel’s book I came up with this: This gets the user to select a class type

Advertisement