第一个类City中创建了另一个类Point的对象,其中Point get_location(void)是什么意思,返回的是什么?怎么在driver里面运行呢?

【c++】

class City
{
Point location;
char name[MAX_CITY_NAME];

public:

double distance(const City & other) const
{
return location.distance(other.location);
}

Point get_location(void) const
{
return location;
}
// other methods and constructors here
};
class Point
{
double x,y;

public:

double distance( const Point & p){ //code }

// other methods and constructors here
};

Point get_location(void)
其实就是

Point get_location()

返回一个代表当前位置的 Point 类型的对象

声明了一个函数,建议没学明白c++的高级应用之前不要接触这些基础知识,那是好好学习的人才会干的事情。