#14065. [GESP202609 六级 C++] 第 16 题

[GESP202609 六级 C++] 第 16 题

下列代码可以正常编译,因为编译器会自动为 Student 类生成一个无参数构造函数。

class Student {
   public:
   Student(int x) {
      age = x;
   }

   private:
   int age;
};

int main() {
   Student s;
}

{{ select(1) }}

  • 正确
  • 错误