public class Point
{
public int X { get; set; }
public int Y { get; set; }
public Point(int x,int y)
{
this.X = x;
this.Y = y;
}
/// <summary>
/// 重载+操作符
/// </summary>
public static Point operator + (Point p1,Point p2)
{
return new Point(p1.X + p2.X,p2.Y + p2.Y);
}
/// <summary>
/// 重载-操作符
/// </summary>
public static Point operator - (Point p1, Point p2)
{
return new Point(p1.X - p2.X, p2.Y - p2.Y);
}
public override string ToString()
{
return string.Format("[{0},{1}]",this.X,this.Y);
}
}