C#????ι??????г???????????
???????????? ???????[ 2013/12/30 16:36:18 ] ????????C# ????
using System;
#region
/*
/// <summary>
/// ????
/// </summary>
class Person
{
//???????
int name;
int height;
//???????
void eat()
{
}
}
class Test
{
static void Main()
{
Person baby = new Person(); //????
baby.name =
Person YaoMin = new Person(); //????
}
}
*/
#endregion
class A
{
//1.?????????????????????????????????????????????????????????
public int i = 100;
public string s = "stone";
public A()
{
Console.WriteLine("constructor");
}
//2.??????????????ι??????г????????????вι??????е?????ι????????????вι??????в????????????????????
public int i;
public string s;
public A()
{
Console.WriteLine("constructor");
i = 100;
s = "stone";
}
public A(int i):this()
{
this.i = i;
}
public A(string s):this()
{
this.s = s;
}
public A(int i?? string s):this()
{
this.i = i;
this.s = s;
}
}
class Test
{
static void Main()
{
//A a = new A();
//Console.WriteLine("i="+a.i);
//Console.WriteLine("s="+a.s);
A a = new A();
Console.WriteLine("first constructor");
Console.WriteLine(a.i);
Console.WriteLine(a.s);
Console.WriteLine();
A a1 = new A(1);
Console.WriteLine("second constructor");
Console.WriteLine(a1.i);
Console.WriteLine(a1.s);
Console.WriteLine();
A a2 = new A("I am third constructor");
Console.WriteLine("third constructor");
Console.WriteLine(a2.i);
Console.WriteLine(a2.s);
Console.WriteLine();
A a3 = new A(3?? "I am the forth constructor");
Console.WriteLine("Forth constructor");
Console.WriteLine(a3.i);
Console.WriteLine(a3.s);
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11