选择题
有如下程序:
class Base{
public:
int data;
};
class Derived1:public Base{};
class Derived2:proteced Base{};
int main()
{
Derived1 d1;
Derived2 d2;
d1.data=0; //①
d2.data=0; //②
return 0;
}
下列关于程序编译结果的描述中,正确的是______。
A、
①②皆无编译错误
B、
①有编译错误,②无编译错误
C、
①无编译错误,②有编译错误
D、
①②皆有编译错误
【正确答案】
C
【答案解析】
提交答案
关闭