I'm try to read a type from a text file and create an instance of it. for example
class MyType {
public:
MyType() {}
~MyType() {}
};
char* type = "MyType";
type object = type();
I know this isn't correct but I think it explains what i'm trying to do pretty good. I am asking if there is a way to do it and how? I know there is a way to covert a type into a string via typeid(Type).name();
but is there a way to reverse this? meaning converting a string to a type.
thanks for reading :).
edit: if you still don't get it. what i want can be done in c# like this
var myObj = Activator.CreateInstance(Type.GetType(namespaceName + className));