Hey everybody,
I have a situation where I have class, one of the elements of the class is a boolean. I also have a vector of that class type. Here is what i do:
vector<myclass> myv;
myclass m1 (initialize the class with the variable set to true)
myclass m2 (initialize the class)
myv.push_back(m1);
cout << myv[0] << endl;
this prints correctly, and the boolean within a class is set to true.
Now, I add another element:
myv.push_back(m2);
cout << myv[0];
Now the printed value shows that the variable is false. Any ideas why this could be? Thank you all.