日期:2014-05-17 浏览次数:21380 次
class Program
{
static void Main(string[] args)
{
正方形 zfx1 = new 正方形();
正方形 zfx2 = new 正方形(10, 20);
正方形 zfx3 = new 正方形(11, 21, 4);
Console.WriteLine("正方形1,坐标:{0},周长:{1},面积:{2}", zfx1.Method1(), zfx1.Method2().ToString(), zfx1.Method3().ToString());
Console.WriteLine("正方形2,坐标:{0},周长:{1},面积:{2}", zfx2.Method1(), zfx2.Method2().ToString(), zfx2.Method3().ToString());
Console.WriteLine("正方形3,坐标:{0},周长:{1},面积:{2}", zfx3.Method1(), zfx3.Method2().ToString(), zfx3.Method3().ToString());
Console.ReadKey();
}
}
class 正方形
{
private int x;
private int y;
private int bianchang;
public int X
{
get { return x; }
set { x = value; }
}
public int Y
{
get { return y; }
set { y = value; }
}
public int Bianchang
{
get { return bianchang; }
set { bianchang = value; }
}
public 正方形()
{
this.X = 0;
this.Y = 0;
this.Bianchang = 0;