Supposing I have a class Dog with attributes age and color. I also have a function print(string) which invokes the accessor functions for the dog attributes. Now when the user enters the name of a Dog object at the command line I would like to call the print function to print these attributes to the screen.
string name;
cout << "Enter the name of a dog";
cin << name;
cout << print(name);

Now, how do I cast the string data type entered by the user into a Dog object so that I can invoke the class functions directly?
Or am I going about it the wrong way?

Please help, this is not homework, I am just trying to learn!

The easiest way would be to do an ifcheck on the input and then set a variable to a number then switch-block the number, ie. User input's Labrador which makes dog_id equal 1, then in the switch-block for case 1 call the function for the dog object with the type of dog being Labrador