// this redefinition of town is more object-oriented in style. // each town knows how to find the way to other towns. To find // the way from A to B, you say A->find_path_to(B, path_taken) struct town { string name; vector roads; town(string n) { name=n; } void add_road_to(town * B) { roads.push_back(B); } int number_of_roads() { return roads.size(); } town * destination_of_road(int i) { return roads[i]; } bool find_path_to(town * dest, vector & path) { path.push_back(this); if (this==dest) return true; for (int i=0; ifind_path_to(dest, path); if (found) return true; } path.pop_back(); return false; } };