struct也有方法成员
using System;
using System.Collections.Generic;
using System.Text;
namespace App1
{
struct Point
{
public Int32 x, y;
public void Change(Int32 x, Int32 y)
{
this.x = x;
this.y = y;
}
//public override string ToString()
//{
// //return base.ToString();
// return string.Format("{0},{1}", x, y);
// //return string.Format("{0},{1},{2}", x, y, x);
//}
}
class Program
{
static void Main(string[] args)
{
Point p = new Point();
p.x = p.y = 1;
Console.WriteLine(p);
//调用p的ToString()方法,若不override---ToString()则输出"App1.Point"
///////////////////////////
Console.Read();
}
}
}
using System.Collections.Generic;
using System.Text;
namespace App1
{
struct Point
{
public Int32 x, y;
public void Change(Int32 x, Int32 y)
{
this.x = x;
this.y = y;
}
//public override string ToString()
//{
// //return base.ToString();
// return string.Format("{0},{1}", x, y);
// //return string.Format("{0},{1},{2}", x, y, x);
//}
}
class Program
{
static void Main(string[] args)
{
Point p = new Point();
p.x = p.y = 1;
Console.WriteLine(p);
//调用p的ToString()方法,若不override---ToString()则输出"App1.Point"
///////////////////////////
Console.Read();
}
}
}