const.cpp

来自「const是C++中很常用而且很灵活的一种变量,学好使用const对变成很有帮助」· C++ 代码 · 共 24 行

CPP
24
字号
// const.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include "Point.h"
using namespace std;

int main(int argc, char* argv[])
{
	Point pt(3,4);
	cout<<pt.cal_dist(Point(10,12))<<endl;
	pt.set_x(6);
	cout<<pt.get_x()<<endl;
	cout<<pt.cal_dist(Point(10,12))<<endl;

	Point const pt_const(1,10);
	//pt_const.set_x(6);
	cout<<Point::center.x<<endl;
	cout<<Point::center.y<<endl;
	cout<<Point::center.get_x()<<endl;
	return 0;
}

⌨️ 快捷键说明

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