point.cpp

来自「孙鑫C++教程(全20讲)PPT讲义」· C++ 代码 · 共 45 行

CPP
45
字号
#include <iostream.h>
class Point
{
public:
	int x;
	int y;
/*	void init()
	{
		x=0;
		y=0;
	}*/
	Point()
	{
		x=0;
		y=0;
	}
	Point(int a,int b)
	{
		x=a;
		y=b;
	}
	~Point()
	{
	}
	void output()
	{
		cout<<x<<endl<<y<<endl;
	}
	void output(int x,int y)
	{
		this->x=x;
		this->y=y;
	}
};

void main()
{
	Point pt(3,3);
	pt.output(5,5);
//	pt.init();
	//pt.x=5;
	//pt.y=5;
//	cout<<pt.x<<endl<<pt.y<<endl;
	pt.output();
}

⌨️ 快捷键说明

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