Looping through a Vector of Object Pointers

Hey guys, lets say for example I have the following vector:

vector<Component*> mComponents;

and a function print() inside of class Component that prints the objects name.

How do I loop/iterate through the vector to access the print function in each object.
I found the solution, never mind, here it is:

1
2
3
4
5
vector<Component*>:: iterator it;
    for (it = mComponents.begin(); it !=mComponents.end(); ++it)
    {
	out += (*it)->name() + ", ";
    }
Topic archived. No new replies allowed.