第20861题 判断
判断给定的C++ Point类代码中第②行定义对象b时的行为是否正确

给定以下C++代码:

class Point {
public:
 double x, y;
 Point(double px, double py) : x(px), y(py) {}
 void print() {
  cout << "(" << x << ", " << y << ")";
 }
};

int main() {
 Point a(3.0, 4.0); // ①
 Point b; // ②
 a.print();
}
A

正确

B

错误

提交0次 正确率0.00%
答案解析