单选题 有如下类声明和函数声明 class Base{ int m; public: int n; protected: int p; }; class Derived: protected Base{ public: int k; }; void f(Derived d); 则在函数f中通过d可访问的数据成员的个数是
【正确答案】 A
【答案解析】解析:保护继承中,基类的public和protected成员在派生类中都是protected成员,所以类Derived中,public成员为:k,protected成员为:n、p,没有private成员,m对Derived不可见;Derived对象d可访问的只有public成员,即k;答案为A。