point.cs
来自「微软(Microsoft)出版社C井练习文件及解答」· CS 代码 · 共 43 行
CS
43 行
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
#endregion
namespace Classes
{
public class Point
{
public Point()
{
this.x = -1;
this.y = -1;
objectCount++;
}
public Point(int x, int y)
{
this.x = x;
this.y = y;
objectCount++;
}
public double DistanceTo(Point other)
{
int xDiff = this.x - other.x;
int yDiff = this.y - other.y;
return Math.Sqrt(xDiff * xDiff + yDiff * yDiff);
}
public static int ObjectCount()
{
return objectCount;
}
private int x, y;
private static int objectCount = 0;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?