单选题
C++
题号 #1545876
参考答案
A
答案解析
派生类D公有继承父类B,所以obj可以访问基类B的公有,不能访问其它成员。
你可能感兴趣的试题
A.friend istream& operator >>(istream& is,MyClass& a);
B.friend istream& operator >>(istream& is,MyClass a);
C.istream& operator >>(istream& is,MyClass& a);
D.istream& operator >>(istream& is,MyClass a);
2
已知主函数中通过如下语句序列实现对函数模板swap的调用:
int a[10],b[10];
swap(a,b,10);
下列对函数模板swap的声明中,会导致上述语句序列发生编译错误的是( )。
int a[10],b[10];
swap(a,b,10);
下列对函数模板swap的声明中,会导致上述语句序列发生编译错误的是( )。
A.template<typename T>
void swap(T a[],T b[],int size);
void swap(T a[],T b[],int size);
B.template<typename T>
void swap(int size,T a[],T b[]);
void swap(int size,T a[],T b[]);
C.tempate<typename T1,typename T2>
void swap(T1 a[],T2 b[],int size);
void swap(T1 a[],T2 b[],int size);
D.template<class T1,class T2>
void swap(T1 a[],T2 b[],int size);
void swap(T1 a[],T2 b[],int size);
