单选题
C++
题号 #4238506
有如下两个类定义:
在类YY中保护成员变量的个数是( )。
参考答案
C
答案解析
本题考查保护继承中派生类对基类的访问属性,在受保护继承中,基类的公用成员和保护成员在派生类中成了保护成员,所以基类的成员x2、y3变成了保护成员,派生类中的y2也是保护成员,所以共有3个保护成员。本题答案为C。
你可能感兴趣的试题
A.cout<<constants->getPI( );和cout<<Constants::getPI( );
B.cout<<constants.getPI( );和cout<<Constants.getPI( );
C.cout<<constants->getPI( );和cout<<Constants->getPI( );
D.cout<<constants.getPI( );和cout<<Constants::getPI( );