#include <iostream>using namespace std;class test{int i;public:test(){cout<<"构造函数"<<endl;}~test(){cout<<"析构造函数"<<endl;}void setvalue(int m){i=m;}int getvalue(){return(i);}};void show(test &newtest){cout<<newtest.getvalue()<<endl;} test change(test newtest,int m){newtest.setvalue(m);show(newtest);return(newtest);}void main(){test mytest;mytest.setvalue(10);show(mytest);change(mytest,100);show(mytest);}上面的程序在调用show函数时,实参是对象而show的形参是对象的地址,这不是明显的实参与形参的类型不符吗?
- 2 回答
- 0 关注
- 78 浏览
添加回答
举报
0/150
提交
取消