suppose i have something like this
What i don't like about this is that it is decided at runtime which type is allocated. Is doing this common, or is there any way to do this better? I mean i could use an enumeration for the storageType.
data = new DerivedType1();
data = new DerivedType2();
As i know the type at compiletime, i could use templates to specify the type, which would be a class.
What is better from a design perspective, runtime decision or using templates?
EDIT: figured out how to pass classes as types to templates