is there any way to compare string item, say given form in stream, with an object name.
Consider the following code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
struct st{};
int main(){
st TestObject;
string STR;
cin >> STR >>endl;
// procedure or code to compare ONLY the NAMES of string and objects.
// if(TestObject == STR
)
...
}
You cannot compare an objects identifier with string.
However what you can do is add a object of type string to class st, which will be the name of objects, then you compare if TestObject.name == "TestObject"