C#???????????
???????????? ???????[ 2016/6/7 13:17:13 ] ??????????? ???????????
????1.???????????
???????????????????????????????????????????????.NET??CLR???????????????????????????GC???LOH????????????????????????????????????????????????????GC??????????GC?????????????????????????????????????佫??????????????????Ч???????????????
????GC??????????С???????????????GC???????????????????LOH???????????????????????????????????GC?????????????????IL?п??????newobj??ldstr(????string????)??newarr(????????μ????????)??box(???)?????????????????
?????????????????????????????????????????????????洢????е?????????????????????????????????????????????????????????????????????????????????Person???Student????????Student s = new Student() { studentId = 2?? Id = 4 };??????s???????????????????????????????????????????????????s???????????????????????????????л???????
public class Person
{
public int Id;
public void Eat()
{
Console.WriteLine("Eat Pear");
}
}
public class Student:Person
{
public int studentId;
public void GotoSchool()
{
Console.WriteLine("Go to School");
}
}
????2.??????????????
??????????д?????????????????????????????????????????д??Person p=new Student();???????д???????????????????????????????????????????????????Person????????鷽???????????????Student??????д???????????п???????????????д???????鷽?????????????Person???????е?2??????????????????????????????????????????Student???????л??????new void Eat()???????????????????p?????????????new Eat()???????????????????????????p??????Person???????е???????????????????????Person???????????object?????????????????????????Student????????????????
????public abstract class Person
????{
????public int Id;
????public void Eat()
????{
????Console.WriteLine( "?????");
????}
????public virtual void Walk()
????{
????Console.WriteLine("?????");
????}
????//??????????????????????????????Person???abstract?????????????????????????????
????public abstract void Run();
????}
????public class Student:Person
????{
????public int studentId;
????public void GotoSchool()
????{
????Console.WriteLine("Go to School");
????}
????public new void Eat()
????{
????Console.WriteLine("??? ?????");
????}
????public override void Walk()
????{
????Console.WriteLine("??? ?????");
????}
????public override void Run()
????{
????Console.WriteLine("??? ?????");
????}
????}
??????
???·???
??????????????????
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