下面代码在 main() 中有一行会导致编译错误,请找出来。

rp186060 单选题 共 个子题
class Student {
public:
    Student(string n, int s) : name(n), score(s) {}

    string getName() {
        return name;
    }

    void setScore(int s) {
        score = s;
    }

private:
    string name;
    int score;
};

int main() {
    Student stu("Tom", 85);
    cout << stu.getName(); // ①
    stu.setScore(90); // ②
    stu.score = 100; // ③
    cout << stu.getName(); // ④
    return 0;
}
A

第 ① 行

B

第 ② 行

C

第 ③ 行

D

第 ④ 行

正在加载题目数据…
已答 /
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析
讨论
发布
登录后参与讨论 立即登录
发布讨论需先绑定并验证手机号 去绑定手机号
加载中…
我
我
回复 @
回复 @
发送
还没有人讨论,来发表第一条吧