昇級版的Field, 用起來像普通Field, 但卻有封裝
private int secrete;
選取/重整/封裝欄位
自動產生
public int Secrete
{
get { return secrete; }
set { secrete = value; }
}
使用
Demo demo = new Demo();
demo.Secrete = 3;
Console.Write(demo.Secrete);
Tuesday, September 25, 2007
Monday, September 24, 2007
Polymorphism
http://cdict.giga.net.tw/q/polymorphism
FOLDOC - Computing Dictionary人物 Christopher Strachey (polymorphism, currying)
length :: [a] -> Intoverloading (operator overloadin)
The ability to use the same syntax for objects of different type
- 10+2
- 1.2+2.5
- "this" + " " + "is"
C#學習之旅
C# Tutorial | wiki
Lesson 1
Main(): like main() in C, 一個專案只能有一個 Class 有 Main()
give 命令列參數in IDE, app/屬性/偵錯/起始選項/命令列的引數
還可以簽署[todo]
args[0]:取得命令列參數
C:\> a.exe 123
args[0]==123
{0}: Parameter Position Holder
Lesson 5
ref: like C & (pass by reference)
out: like VB (output variable for return more than one value)
params: 不定個數參數
f(params string[] names)
f("apple","banana","orange")
f( string[] names)
f(["apple","banana","orange"])
static void Main(string[] args)
{
string[] names = { "a", "b", "c" };
this.DemoParams("a", "b", "c");
this.WithoutParams(names);
}
this 不能用在靜態成員
Lesson 1
Main(): like main() in C, 一個專案只能有一個 Class 有 Main()
give 命令列參數in IDE, app/屬性/偵錯/起始選項/命令列的引數
還可以簽署[todo]
args[0]:取得命令列參數
C:\> a.exe 123
args[0]==123
{0}: Parameter Position Holder
Lesson 5
ref: like C & (pass by reference)
out: like VB (output variable for return more than one value)
params: 不定個數參數
f(params string[] names)
f("apple","banana","orange")
f( string[] names)
f(["apple","banana","orange"])
static void Main(string[] args)
{
string[] names = { "a", "b", "c" };
this.DemoParams("a", "b", "c");
this.WithoutParams(names);
}
this 不能用在靜態成員
Subscribe to:
Posts (Atom)