根据给出的C++代码,关于公有继承下的访问权限,下列说法正确的是?
#include <iostream>
using namespace std;
class Base {
public:
int a = 10;
protected:
int b = 20;
private:
int c = 30;
};
class Derived : public Base {
public:
void func() {
// 此处测试派生类成员对基类成员的访问权限
}
};
int main() {
Derived d;
// 此处测试派生类对象对基类成员的访问权限
return 0;
}
正在加载题目数据…
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析