我有这段代码:
#include <iostream>
struct Point {
int x, y;
Point(int x, int y): x(x), y(y) {};
Point operator+(const Point& other) const {
return Point(x + other.x, x + other.y);
}
};
std::ostream& operator<<(std::ostream& os, const Point& p) {
return os << "(" << p.x << "," << p.y << ")";
}
int main() {
Point p = Point(4,7) + Point(8,3);
std::cout << p << std::endl;
}
我收到上面的错误。我认为应该可以。如何访问结果集的第一条记录?总会有一击,顺便说一句,因此我使用0。