西西河

主题:【原创】这才是有中国特色的Java程序!!! -- Highway

  • 共: 💬 25 🌺 8
一点都不稀奇,.NET谁都可以这么做。

public class 猪猪

{

private string _猪鼻子;

private string _猪尾巴;

public string 猪尾巴

{

get { return this._猪尾巴; }

set { this._猪尾巴 = value; }

}

public 猪猪(int 猪鼻子长, int 猪尾巴长)

{

this._猪鼻子 = 猪鼻子长.ToString();

this._猪尾巴 = this.转换猪尾巴(猪尾巴长);

}

public void 换猪鼻子(string 新猪鼻子)

{

this._猪鼻子 = 新猪鼻子;

}

private string 转换猪尾巴(int 猪尾巴长)

{

return string.Format("猪尾巴长:{0}", 猪尾巴长);

}

}

static class Program

{

[STAThread]

static void Main()

{

猪猪 一只猪 = new 猪猪(20, 50);

Console.Write(一只猪.猪尾巴);

}

}



有趣有益,互惠互利;开阔视野,博采众长。
虚拟的网络,真实的人。天南地北客,相逢皆朋友

Copyright © cchere 西西河