I'm trying to create a vector array that contains pointers, and these pointers point to objects(particles) that have been created while the program is running.

How do I use the appropriate de-reference operator to use functions of the class particle?
ex. particle.move();
Here is what I have and my guess:

#include <vector>
#include <particle.h>

void main() {
vector <particle*> vect_a;

vect_a.push_back(new particle);



Here, the compiler doesn't think i've declared 'move', but particle.move() works fine outside of the vector of pointers.


Try something like this :

#include <vector>
#include <particle.h>

using std::vector;

int main() {
vector <particle*> vec;
vec.push_back(new particle());
vec.front()->move(); //option 1
vec[0]->move(); //option 2

Solved the problem,

thanks much!