填空题
下列程序的运行结果为______。
#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 objl;
obj1.fun( );
【参考答案】
a=A0,this->a=E
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
参照函数模板的写法,完成非模板函数的定义,语句为______。 #include<iostream.h> #include<string.h> template<class T> T min(T a,T b) return(a<b a:b); char*rain(char*a,char*b) ______ void main( ) double a=1.23,b=3.45; char s1[]= abed ,s2[]= efg ; cout<<min(a,b)<<min(s1,s2)<<endl;
点击查看答案&解析
填空题
在下面的类定义中,this指针的用途是______。 #include<iostream.h> class Sample int x,y; public: Sample(int i,int j)x=i;y=j; void assign(Sample sa); ; void Sample::assign(Sample p) if(this!=&p) x=p.x; y=p.y;
点击查看答案&解析
相关试题
下列程序的运行结果是______。 #in...
下列程序编译错误,因为add函数返回值是一...