C#成员名称不能与它们的封闭类型相同
class Point{
private struct Point
{
public int X;
public int Y;
}
private int x;
public int X
{
get { return x; }
set { x = value; }
}
private int y;
public int Y
{
get { return y; }
set { y = value; }
}
public void Increment()
{
X++; Y++;
}
public void Decrement()
{
X--; Y--;
}
public void Display()
{
Console.WriteLine("X = {0},Y = {1}",X,Y);
}
}
class Class1
{
static void Main(string[] args)
{
Point myPoint;
myPoint.X = 39;
myPoint.Y = 93;
myPoint.Display();
myPoint.Increment();
myPoint.Decrement();
Console.ReadLine();
}
} --------------------编程问答-------------------- class Point 和private struct Point两个的名称不能一样,改其中任意一个为其它的名字就可以了
--------------------编程问答-------------------- 不能~
补充:.NET技术 , C#