Hokay. So I have a vector of pointer to my class. We'll call it myClass. So the code is
vector <myClass> collection;
collection.push_back(new myClass);
So all that seems to work fine. Now, I need to set up some of the class instances properties. This is where i run into trouble:
collection[0].someProperty = 432;
This doesn't work, it say 'item to the left of ".someProperty" must have a struct/type/union bla bla bal"
I'm not sure if this is caused my lack of knowledge about vectors or pointers. Can you work with a pointer to class instance the same way you would an actual instance? I need a dynamic array of class instances, but I also need to be able to customize each one. Thank you.
vector <myClass> collection;
collection.push_back(new myClass);
So all that seems to work fine. Now, I need to set up some of the class instances properties. This is where i run into trouble:
collection[0].someProperty = 432;
This doesn't work, it say 'item to the left of ".someProperty" must have a struct/type/union bla bla bal"
I'm not sure if this is caused my lack of knowledge about vectors or pointers. Can you work with a pointer to class instance the same way you would an actual instance? I need a dynamic array of class instances, but I also need to be able to customize each one. Thank you.