|
本题添加时间:2023/4/3 12:59:00 |
|
圆梦客服:王老师 19139051760(微信同号) 19139051760(微信同号) |
[应用题,25分] #include class Test; void fun1(Test t); Test fun2(); class Test { public: Test(int n=1) {val=n; cout<<"Con."< Test(const Test& t) {val=t.val; cout<<"Copy con."<<> Test& operator = (Test& t) { val=t.val; cout<<"Assignment."<<> return *this; } private: int val; }; void main() { Test t1(1); Test t2=t1; Test t3; t3=t1; fun1(t2); t3=fun2(); } void fun1(Test t){} Test fun2() { Test t; return t; } 运行结果为:
|
答案是:Con.Copy con.Con.Assignment.Copy con.Con.Copy con.Assignment.
出自
许昌学院面向对象程序设计 青书学堂系统
许昌学院
|
更多试题>>>>
1、[应用题,25分] #include
float const PI=3.14;
class point
{
private:
float x,y,area;
public:
point(float x1=0.0,float
2、[应用题,25分] #include
# include
void fun(char *w,int m)
{char s,*p1,*p2;
p1=w;
p2=w+m-1;
while(p1<>
{
s=*p1;*p1=*p2
3、[应用题,25分] #include
#include
#include
main()
{
int a=4,b=5,c,d;
cout<<”sqrt(a)=”<< sqrt(a)<
c=a>b?a:b;
cout<<”c=”
4、[应用题,25分] #include
fun(int *s,int n1,int n2)
{ int t;
while(n1<>
{t=*(s+n1);
*(s+n1)=*(s+n2);
*(s+n2)=t;
n1++;n2-
5、[应用题,25分] #include
void f(int *p1, int *p2)
{ int *t;
t=p1;p1=p2;p2=t;
}
main()
{ int a=10,b=20;
cout<<><>
f(&a,
|
|