我最近在学习 C# 并了解基础知识。我不是在下面写这段代码,而是试图理解它。line 类在声明 start 和 end 字段时使用 Point。这在 C# 中叫什么?
public class Point
{
private float x;
public float X
{
get { return x; }
set { x = value; }
}
private float y;
public float Y
{
get { return y; }
set { y = value; }
}
public Point(float x, float y)
{
this.x = x;
this.y = y;
}
public Point():this(0,0)
{
}
}
}
class Line
{
private Point start;
public Point Start
{
get { return start; }
set { start = value; }
}
private Point end;
public Point End
{
get { return end; }
set { end = value; }
}
public Line(Point start, Point end)
{
this.start = start;
this.end = end;
}
public Line():this(new Point(), new Point())
{
}