单选题将运算符“+"重载为非成员函数,下列原型声明中,错误的是( )。
单选题代码编写阶段可进行的软件测试是
单选题下面是类Shape的定义:
class Shape{
public:
virtual void Draw()=0;
};
下列关于Shape类的描述中,正确的是______。
单选题已知数组arr的定义如下:int arr[5] = {1,2,3,4,5};下列语句中输出结果不是5的是
单选题关于纯虚函数,下列表述中正确的是______。
单选题数据库管理系统(DBMS)是
单选题下列关于函数模板的说法,正确的是______。
单选题下面程序的输出结果是 #include<iostream,h> class example int a; public: example(int b) a=b++; void print( )a=a+1;cout<<a<<""; void print( )constcout<<a<<""; ; void main( ) example X(3); const example y(2); x.print( ); y.print( );
单选题要定义数组a,使得其中每个元素的数据依次为3,9,4,8,0,0,0,错误的定义语句是 ( )。 A) int a[]=3,9,4,8,0,0,0; B) int a[9]=3,9,4,8,0,0,0; C) int a[]=3,9,4,8; D) int a[7]=3,9,4,8,0,0,0;
单选题执行下列程序的结果是
main( )
{
float x=1,y;
y=++x*++x;
cout<<y<<endl;
}
单选题下列代码声明了3个类:
class Person{};
class Student:public Person{};
class Undergraduate:Student{};
下列关于这些类之间关系的描述中,错误的是______。
单选题有如下头文件
int f1();
static int f2();
class MA{
public:
int f3();
static int f4();
};
在所描述的函数中,具有隐含的this指针的是______。
单选题考虑下面的函数原型: void f(int a,int b=7,char c='@'); 下面的函数调用中,不合法的是( )。
单选题下列表示纯虚函数的成员函数是
A. virtual int func (int);
B. void func(int)=0;
C. virtual void func=0;
D. virtual void flmc(int){}
单选题为了使类中的某个成员不能被类的对象通过成员操作符访问,则不能把该成员的访问权限定义为______。
单选题以下程序的输出结果是( )。
#include<iostream.h>
void main( )
{ int a=21,b=11;
cout<<- -a+b;}
单选题一个栈的初始状态为空。现将元素1、2、3、4、5、A、B、C、D、E依次入栈,然后再依次出栈,则元素出栈的顺序是( )。
单选题有以下程序:
classDate
{public:
Date(inty,intm,intd);
{year=Y;
month=m;
day=d;}
Date(inty=2000)
{year=y;
month=10;
day=1;}
Date(Date&d)
{year=d.year;
month=d.month;
day=d.day;}
voidprint()
{cout< day< private:
intyear,month,day;};
Datefun(Dated)
{Datetemp;
temp=d;
returntemp;}
intmain()
{Datedatel(2000,1,1),date2(0,0,O);
Datedate3(date1);
date2=fun(date3);
return0;}
程序执行时,Date类的复制构造函数被调用的次数是( )。
单选题若有以下定义和语句: int s[4][5],(*p)[5]; p=s; 则指针对s数组中第三个元素的正确引用形式是( )。
单选题有以下程序:#include <iostream>using namespace std;class sample{ private: int n;public: sample(){ } sample(int m) { n=m; } sample add(sample s1,sample s2) { this->n=s1. n+s2.n; return (*this); } void disp() { cout<<"n="<<n<<end1; }};int main(){ sample s1(10),s2(5),s3; s3.add(s1,s2); s3.disp(); return 0,}