⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 7_70.cpp

📁 里面有各种各样的程序例子可以供初学者使用而且非常有趣欢迎刚兴趣的读者前来下载
💻 CPP
字号:
#include<iostream.h>
class point
{
public:
	point(int x,int y) {X=x,Y=y;cout<<"Constructor called!"<<endl;}
	point(point &p);
	~point() {cout<<"Destructor called"<<endl;}
	int getX(){return X;}
	int getY(){return Y;}
private:
	int X,Y;
};
point::point(point &p)
{
	X=p.X;
	Y=p.Y;
	cout<<"Copy-initialization Constructor called!"<<endl;
}
point fun(point A)
{
	cout<<"The function of \'fun\' is called!"<<endl;
	int x=A.getX()+5;
	int y=A.getY()+10;
	point R(x,y);
	return R;
}
void main()
{
	point M(6,7),P(0,0),S(0,0);
	point N(M);
	P=fun(N);
	S=M;
	cout<<"P="<<P.getX()<<","<<P.getY()<<endl;
    cout<<"S="<<S.getX()<<","<<S.getY()<<endl;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -