下列代码可以正常编译,因为编译器会自动为 Student 类生成一个无参数构造函数。
class Student {
public:
Student(int x) {
age = x;
}
private:
int age;
};
int main() {
Student s;
}
正在加载题目数据…
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析