I am in the process of learning c++. So i know a method by which you send something to function and then work as if it was call by value but actually it is call by reference
Using std::vector you can also do the following:
std::vector
void list_cities(std::vector &cities) { for (size_t iCity = 0; iCity < cities.size(); iCity++){ cout << cities[iCity].get_name() << endl; } } std::vector cities; // fill list here list_cities(cities);