Kind of new at this, but I had a question that I couldnt answer on my own. I was fooling around with classes, and I made several members of classes and I wanted to call them up based on what someone typed.
This of course, doesnt work, because it thinks that mdl is some sort of member of the class and its saying that it doesnt have a make attribute etc etc. Im wondering how I can use mdl as a variable in this situation, so depending on what i typed in for mdl, It would give me all of its stuff. So if mdl = camaro, or mdl = escape, then it would give me camaro.make , or escape.make etc. in this situation.Code:string mdl; cin >> mdl; cout << mdl.make << endl << mdl.year << endl << "$" << mdl.price << endl << "Space #" << mdl.space << endl << endl;
If its not possible like this, thats fine, I was just wondering.