第一章6.txt

来自「本书在复习C++基础知识后」· 文本 代码 · 共 25 行

TXT
25
字号
#include <iostream.h>
class CPoint
{
public:
		CPoint( int x = 0, int y = 0 ) 	
		{ 	xPos = x; 		yPos = y; 	} 
public:	
		void Copy( CPoint one)
		{
			*this = one;
		}								// 直接通过this赋值
		void  Print() 	
		{
			cout<<"Point("<<xPos<<", " <<yPos<<")"<< endl;	
	 	}  
private:    
		int xPos,  yPos;
};
int main()
{
		CPoint pt1(10, 20), pt2(30, 40);
		pt1.Print();		pt1.Copy(pt2);		pt1.Print();
		return 0;
}

⌨️ 快捷键说明

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