单选题有以下程序: #include <iostream> #include <string> using namespace std; class Y; class X private: int x; char *strx; public: X(int a, char *str) x=a; strx=new char[strlen(str)+1]; strcpy(strx,str); void show(Y ; class Y private: int y; char *stry; public: Y(int b,char *str) y=b; stry=new char[strlen(str)+1]; strcpy(stry, str); friend void X: :show(Y ; void X: :show(Y cout<<ob, stry<<end1; int main ( ) X a(10,"X"); Y b (20, "Y"); a. show(B) ; return 0; 执行后的输出结果是( )。
单选题以下关于友元函数的叙述不正确的是 A) 友元函数提供了类之间数据共事的一个途径 B) 一个友元函数可以访问任何类的任何成员 C) 友元函数破坏了数据的封装 D) 友元函数增加了程序设计的灵活性
单选题当派生类从一个基类保护继承时,基类中的一些成员在派生类中成为保护成员,这些成员在基类中原有的访问属性是( )。
单选题下列描述中错误的是
单选题模板是实现类属机制的一种工具,其功能非常强大,它允许用户构造类属类,即( )。 A.模板函数 B.函数模板 C.模板类 D.类模板
单选题在面向对象的程序设计中,下列叙述中错误的是 A) 任何一个对象构成一个独立的模块 B) 一个对象不是独立存在的实体,各个对象之间有关联,相互依赖 C) 下一层次的对象可以继承上一层次对象的某些属性 D) 上述三种说法都正确
单选题有如下类定义:
class Point{
private;
static int how_many;
};
______how_many=0;
要初始化Point类的静态成员how_many,下划线处应填入的内容是______。
单选题有如下程序:
#include<iostream>
using namespace std;
void f1(int}
void f2(int x){++x;}
int main(){
int x=10,y=12;
f1(x);
f2(y);
cout<<x+y<<endl;
return 0;
}
运行这个程序的输出结果是______。
单选题将x+y*z中的“+”用成员函数重载,“*”是友元函数重载应写为( )。
单选题如果不使用多态机制,那么通过基类的指针虽然可以指向派生类对象,但是只能访问从基类继承的成员。有如下程序,没有使用多态机制。#include<iostream>using namespace std;class Base{ int a,b;public: Base(int x,int y){a=x;b=y;} void show(){cout<<a<<','<<b<<endl;}};class Derived:public Base{ int c,d;public: Derived(int x,int y,int z,int m):Base(x,y){c=z;d=w;} void show(){cout<<c<<','<<d<<endl;}};int main(){ Base B1(50,50),*pb; Derived D1(10,20,30,40); pb=&D1; pb->show(); return 0;}运行时输出的结果是
单选题下列程序输出的结果是( )。 #include<stdio.h> funl(char a,char b)char c;c=a;a=b;b=c; fun2(char *a,char b)char c;c=*a;*a=b;b=c; fun3(char *a,char *b)char c;c=*a;*a=*b;*b=c; void main() char a,b; a='A';b='B';fun1(a,b);putchar(a);putchar(b); a='A';b='B';fun2(&a,b);putchar(a);putchar(b); a='A';b='B';fun3(&a,&b);putchar(a);putchar(b); putchar('/n');
单选题软件详细设计产生的如右图所示。该图是()。
单选题有如下程序:
#include
usingnamespacestd;
intmain()
{
int*P;
*P=9:
cout<<"ThevalueatP:"<<*P;
return0;
}
编译运行程序将出现的情况是( )。
单选题以下
____
特征不是面向对象思想中的主要特征。
单选题下列选项中不属于结构化程序设计原则的是______。
单选题有如下程序: #include<iostream> using namespace std; class Point{ int x,y; public: Point(int x1=0,int y1=0):x(x1),y(y1){} int get(){return x+y;} }; class Circle{ Point center; int radius; public: Circle(int cx,int cy,int r):center(cx,cy),radius(r){} int getO{return center.get0+radius;} }; int main(){ Circle c(3,4,5); cout<<c.get()<<end1; return 0; } 运行时的输出结果是( )。
单选题执行语句序列 ofstream outfile ("DATA. DAT"); if(...)cout <<"OK";else cout <<"FAIL";后,如果文件打开成功,显示"OK",否则就显示"FAIL"。由此可知,上面if语句的...处的表达式应是______ 。
单选题有三个关系R、S和T如下:则由关系R和S得到关系T的操作是()。
单选题软件工程管理的具体内容不包括对( )管理。
单选题C++语言中函数返回值的类型决定于
