单选题下列虚基类的声明中正确的是 ______。
单选题下面关于C++流的叙述中,正确的是( )。
单选题要定义整型数组x,使之包括初值为O的三个元素,下列语句中错误的是
单选题下面关于虚函数的表述中正确的是( )。 A) 虚函数不能声明为另一个类的友元函数 B) 派生类必须重新定义基类的虚函数 C) 如果在重定义虚函数时使用了保留字virtual,那么该重定义函数仍是虚函数 D) 虚函数不能够声明为静态函数
单选题有如下头文件: int f1(); static int f2(); class MA{ public: int f3(); static int f4(); }; 在所描述的函数中,具有隐含的this指针的是( )。
单选题下面程序的输出结果是( )。
#include
class example
{
int a;
public:
example(int b){a=b++;}
void print(){a=a+1;cout<
单选题已知类A有公用数据成员a,并重载了“=”运算符,且有A obj2;const A*ptr new A;则下列语句错误的是
____
。
单选题由于常对象不能被更新,因此______。 A.通过常对象只能调用它的常成员函数 B.通过常对象只能调用静态成员函数 C.常对象的成员都是常成员 D.通过常对象可以调用任何不改变对象值的成员函数
单选题一间宿舍可住多个学生,则实体宿舍和学生之间的联系是
单选题将小写字母'n'赋值给字符变量ch,正确的操作是( )。
单选题数据字典(DD) 是定义以下哪种系统描述工具中的数据的工具( )。
单选题类模板template<class T>class x(…),其中,友元函数f成为从该类模板实例化的每个模板类的友元,则其说明应为( )。
单选题有如下程序:
#include <iostream>
using namespace std;
class AA{
int n;
public:
AA(int k):n(k) { }
int get(){return n; }
int get()const{return n+1;}
}
int main()
{
AA a(5);
const AA b(6);
cout<<a.get()<<b.get();
return 0;
}
执行后的输出结果是
____
。
单选题若磁盘上已存在某个文本文件,其全路径文件名为d:\ncre\test.txt,下列语句中不能打开该文件的是( )。
单选题下列程序的运行结果为
#include<iostream.h>
void main( )
{
int a=2;
int b=a+1;
cout < < a/b < < endl;
}
单选题有如下程序:
#include<iostream>
using namespace std;
class base{
public:
base(int x=0){cout<<x;}
};
class derived:public base{
public:
derived(int x=y){cout<<x;}
public:
base val;
};
int main(){
derived d(1);
return 0;
}
程序的输出结果是______。
单选题以下程序的输出的结果是( )。 #include<iostream.h> void main() { int a,b,C,d(5); c=2,c+=10; a=b=10: a*=2: b/=2: C%=2: cout<<a<<“,”<<b<<“,”<<c<<endl; }
单选题有如下程序:
#include
usingnamespacestd;
classBase{
public:
Base(intx=O){cout< };
classDerived:publicBase{
public:
Derived(intx=O){cout<
private:
Baseval;
};
intmain(){
Derivedd(1);
return0;
}
程序执行后的输出结果是( )。
单选题有如下程序:#include<iostream>class A{public:A(int n=2):m_i(n){}~A(){std::cout<<m_i;}protected:int m_i;};class B:public A{public:B(int n):m_a2(n),m_al(m_i+1){}public:~B(){std::cout<<m_i;--m_i;}private:A m_a1;A m_a2:};int main(){B b(5);return0;}运行后的输出结果是( )。
单选题有如下程序:
#include<iostream>
using namespace std;
class Boat;
class Car{
public:
Car(int i):weight(i){}
friend int Total(const Car //①
private:
int weight;
};
class Boat{
public:
Boat(int i):weight(i){}
friend int Total(const Car
private:
int weight;
};
int Total(const Car
}
int main(){
Car c(10);
Boat b(8);
cout<<"The total weight is"<<Total(c,b)<<endl; //③
return 0;
}
下列关于程序的描述中,正确的是______。