C# ????????????
???????????? ???????[ 2015/6/30 13:51:41 ] ????????.NET ???????
?????????????????Щ???????????????????????????????????????????????????????????????????????????????????Σ?????????????????????????κξ???????????.NET??????á?
??????????????????????????????????????????????????????????????漰???????????????????????????????????????????????????????????????????????????????????????????????????t????????????????????????????????????????????
/// <summary>
/// ????
/// </summary>
public class A
{
public static string Field = "original-test";
//?????????
static A()
{
Field = "test-a";
}
public static void Test()
{
Console.WriteLine("the output is : " + Field);
}
}
/// <summary>
/// ????
/// </summary>
public class B : A
{
//?????????
static B()
{
Field = "test-b";
}
public static new void Test()
{
A.Test();//???????????????????Test??????????????????????????????B.Test()?????????????????Test??????
} }
??????????????????B??????????A??B?е?????????????????Field???и???????????????????е?Test?????????????B??Test???????????????????????A??Test???????????????????е????????????????????Field???????B???????????и??????test-b??
???????y?????£?
????static void Main(string[] args)
????{
????A.Test();//???the output is : test-a
????B.Test();//???the output is : test-b
????Console.ReadLine();
????}
????A.Test()?????Field??test-a;??B.Test()?????Field??test-b??
?????????????????????????????????????????????????????????и????????????????????????????????????ж?????????????????????????????е?????????
?????????????????????????е?????????????????????B.Test()?????????????Test()??????????Field????????????е???????????????????£???
????static void Main(string[] args)
????{
????A.Test();//???the output is : test-a
????B.Test();//???the output is : test-a???????и????????????????A.Test()
????Console.ReadLine();
????}
??????
???·???
??????????????????
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