补充代码,实现v1中的10 加v2中的20, v1中的2 加v2中的5,输出30 和7
#include <iostream>
using namespace std;
class Vector2D {
int x, y;
public:
Vector2D(int x, int y) : x(x), y(y) {}
};
int main() {
Vector2D v1(10, 2), v2(20, 5);
cout << v1 + v2 << endl; // 输出 30和 7
}