Not sure if anyone's pointed this out already or not, as skimming through the posts it appears most of them are just reiterating the same thing over and over
Anyway, there is a method called polymorphism which can be used in this situation, though not very stylistically/programmatically appreciated.
Say you had a set of classes: apple, carrot, pizza, etc... and they're all food. So you have a base class called the "food" class:
This class can then be "inherited" by your food classes to create the children classes:
//implementation with virtual functions and etc...
virtual void doFoodStuff()=0;
And then, say you wanted the user to input what type of food they want to interact with, you could do the following:
class apple : public food
//Now you actually implement the food functions
Polymorphism is a very fun concept. This, however, is only one solution to the problem at hand, and another (possibly) better solution would be to have a class behave much like a relational array, where when you create the class you give it a name:
<grab user input for a name>
foodItem->doFoodStuff(); // This will now execute whichever item of food's function that the user asked for
Then the implementation of the constructor function would associate the class with a new id in the classList array. Then from that point on, you could have an associative array (overloaded of course) so that whenever you do [myClass] where myClass is a char* it will automatically pull the class's variables that you're looking for.
int createNewClass(char* className);
Hopefully this hasn't been a bit too over-the-top and you can get something from it. See my article on Module Design for Game Development and also the discussions following it for more information on polymorphism.