C++之共有继承、保护继承、私有继承 - 唯一诺 - 博客园
定义如下类,会引起编译器报错的是()
class Base
{ public:
int base_public;
protected:
int base_protect;
private:
int base_private;
};
class Derive :private Base
{
public:
using Base::base_public; //语句1
using Base::base_protect; //语句2
private:
using Base::base_private; //语句3
};
int main()
{
Derive d;
d.base_protect=1; //语句4
}
A:语句1
B:语句2
C:语句3
D:语句4
答案:C
C++之共有继承、保护继承、私有继承 - 唯一诺 - 博客园