Let's say I have the following code:
Ok, now here's what I am trying to accomplish. I have this loop with a keypress condition check. When the user presses the key, I want to push_back an entry to vClass with a set x and y value. The closest I got was a miserable crash with no error message when I pushed the key.Code:class myClass {
private:
int x, y;
public:
myClass();
myClass(int t_x, int t_y) { x = t_x; y = t_y; }
~myClass();
};
myClass aClass;
vector<myClass> vClass;
No need to worry about the key condition stuff since I got that taken care of already. I just need some help on how to manage with the vector as described.
Something like this, but of course it does not work:
If this could done more efficiently, great.Code:vClass.push_back(aClass(2, 4))
Thanks.