point.cpp
来自「point类对象的编写上机调试通过」· C++ 代码 · 共 36 行
CPP
36 行
#include"point.h"
void fun1(point p)
{
cout<<p.get_x()<<endl;
p.set(100,99);
}
point fun2()
{
point a(1,2);
return a;
}
void main()
{
point a(4,3);
point b(a);
cout<<b.get_x()<<endl;
fun1(b);
b=fun2();
cout<<b.get_x()<<endl;
}
/*
point类的对象(4,3)的构造函数被调用
point类的对象(4,3)的拷贝构造函数被调用
4
point类的对象(4,3)的拷贝构造函数被调用
4
point类的对象(100,99)的析构函数被调用
point类的对象(1,2)的构造函数被调用
point类的对象(1,2)的拷贝构造函数被调用
point类的对象(1,2)的析构函数被调用
point类的对象(1,2)的析构函数被调用
1
point类的对象(1,2)的析构函数被调用
point类的对象(4,3)的析构函数被调用
Press any key to continue
*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?