第41710题 判断题
下面定义了一个表示二维坐标点的类 Point, 并提供了一个带参数的构造函数,但第 ② 行 Point b; 会调用编译器自动生成的默认构造函数,将b.x 和 b.y 被初始化为 0.0,程序可以正常编译运行。( )
class Point:
    def __init__(self, px, py):
        self.x = px
        self.y = py

    def print(self):
        print(f"({self.x}, {self.y})")

if __name__ == "__main__":
    a = Point(3.0, 4.0) # ①
    # ②
    b = Point()
    a.print()
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
知识点:
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析