I'm trying to use the value stored in an std::string to call a class instance of the same name, for example:
class myClass{int x;}
myClass hello;
std::string myString = "hello";
And then by doing this:
myClass* pleaseWork = myString*;
I'm hoping I can then do this:
std::cout << pleaseWork&.x;
I'm just wondering if this actually is possible, or if there's a keyword like
changeToClass(<string>, <classToBeTurnedInto>)
Thank you!
EDIT
Sorry if I didn't make it too clear, but what I'm trying to do is call a class whose name is stored in a string - so if myString contains "hello" I'm trying to call a class called "hello" by using the actual string. The practical use of this involves passing classes of class1 to classes of class2, but only knowing which classes to pass on by reading them from a file (which can only be read as char[] or std::string).
A bit like this, which I'm not sure how to do in C++.