填空题
下列程序的运行结果为
【14】
。
#include <iostream. h>
class myclass
private:
int a, b, c;
public:
void fun()
int a;
a=10;
this->,a=5;
b=6;
this->c=7;
cout<<"a="<<a<<",this->a="<<this->a<<endl;
;
void main()
myclass obj1;
obj1.fun()
【参考答案】
a=A0, this->a=E
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
下列程序的运行结果是 【15】 。 #include<iostream, h> class Sample int a; public: Sample(int aa=0) a=aa; ~Sample() cout<< Sample= <<a<<; class Derived: public Sample int b; public: Derived(int aa=0, int bb=0): Sample(aa) b=bb; ~De rived() cout << Derived= <<b<<’’; void main() Derived dl (9)
点击查看答案&解析
填空题
下列程序编译错误,因为add函数返回值是一个引用,故对return后返回值的要求是 【10】 。 #include<iostream. h> int& add(int x, int y) return x+y; void main( ) int i=3,j=19; cout<<(add(i,j)+ =20)<<end1;
点击查看答案&解析
相关试题
参照函数模板的写法,完成非模板函数的定义...
下列程序中的this指针的作用是 【13】 ...