题库 / 3060802. 以下C++代码段中存在语法错误或逻辑错误,()是正确…(2024-12)
3060802. 以下C++代码段中存在语法错误或逻辑错误,()是正确…(2024-12)
题目描述
以下C++代码段中存在语法错误或逻辑错误,()是正确的。
#include <iostream>
using namespace std;
class MyClass {
public:
MyClass() {
cout << "Constructor called!" << endl;
}
void display() {
cout << "Display function called!" << endl;
}
};
int main() {
MyClass* obj = NULL;
obj->display();
return 0;
}
作答说明
单选题:在选项里选出唯一正确的一项,提交后立即判定。答对得满分,答错可以重新提交(两次提交之间需要间隔 20 秒)。
题目来源
CCF GESP 2024 年 12 月认证 C++ 6 级试题,第 3 题。