来自「C语言相关程序」· 代码 · 共 27 行
TXT
27 行
#include<iostream.h>
class location
{
public:
location(int xx=0,int yy=0)
{X=xx,Y=yy;};
location(location & p);
int GETX()
{return X;}
int GETY()
{return Y;}
private:
int X,Y;
};
location::location(location & p)
{
X=p.X;
Y=p.Y;
cout<<"Copy_constructor called."<<endl;
}
main()
{
location A(1,2);
location B(A);
cout<<"B:"<<B.GETX()<<","<<B.GETY()<<endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?