第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();
}
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析