填空题

有以下程序: #include<iostream.h> classA { int x; public: A(int A) { x=a; } friend class B; }; class B{ public: void print(AA) { a.x--; cout<<a.x<<end1; } }; void main() { Aa(10); Bb; b.print(A) ; } 程序执行后的输出结果是 【14】 。

【参考答案】

I
<上一题 目录 下一题>
热门 试题

填空题
下面是“二维向量”vector2D的定义,其中作为成员函数重载的运算符“+”的功能是将两向量的分量x和y对应相加,然后返回作为相加结果的新对象;请填空补充完整。class vector2D{double x; x分量double y; y分量public:vector2D(double x0=0,double y0=0):x(x0),y(y0){}void show(cout<<’(’<<’,’<<y<<’)’;}vector2D operator+(vector2D) ;};【11】 operator + (vector2D A) {return vector2D( 【12】 );}
填空题
在下面横线上填上适当的语句,完成程序。#include<iostream>using namespace std;class Base{int x;public:Base(int i){x=i;}~Base(){}};class Derived:public Base{public:【10】 完成类Derive构造函数的定义};int main(){Derived Obj;return 0;}
相关试题
  • 下面程序的输出结果是 【15】 。#incl...
  • 已知:double A(double A) {return ...