How to add objects to a vector?

In my experimental code, I’m trying to add some objects to a vector (the approx. equivalent of arrayList in java) so I can access these objects fairly easily and have them organized in one location. The only problem is I can’t figure out how to add the objects to the vector. Any help would be appreciated.
ObjsToVector

you probaly shouldn’t be using vectors if you’re this new to c++. That being said, define red2 on a seperate line, and then pass red2 to the function.

I mean I’ve done object oriented before, just in Java. The problem is even if I use the already created red1, it still doesn’t work.

Edit:
initBoi(red1); doesn’t work either.

try using pass by reference. basically, slap an ampersand into the function declaration before obj

hold on, i’m actually stupid. i forgot to put it into a task.

2 Likes