???????????????C#?з???????д?????£????巽????????
?????????????????д??
????“??д”????????????????????????????????ж??????????±?д??
?????????????????д??????????
??????????????и??????????????????з???????????ú???е?????????????
??????????????????????е??з????в???????????
?????????????????д??
????a.??д????????????override?????(????override????????ε?????????????????
?????????????);
????b.???д???????????????????и??????д??????????????virtual??????abstract??
?????????????дstatic????????鷽?????????????????д????????virtual?????????
????????????????д????????(???C#?е???????????? virtual?????????????
????virtual?????????????д);
????c.virtual????????????????????????????virtual????????ε???????“????
??????”(?鷽??).
????[???????η?]virtual[????????]?????????????б??
????{
????//?????????????÷??????????????д
????}
???????洴?????????ó???
????namespaceinheritDemo2
????{
????classEmployee
????{
????publicvirtualvoidEmpInfo()
????{
????Console.WriteLine("??virtual????????ε????????????");
????}
????}
????classDervEmployee:Employee
????{
????publicoverridevoidEmpInfo()
????{
????base.EmpInfo();//base???????????????????
????Console.WriteLine("?÷?????дbase????");
????}
????}
????classTest
????{
????staticvoidMain(string[]args)
????{
????DervEmployeeobjDervEmployee=newDervEmployee();
????objDervEmployee.EmpInfo();
????//???objDervEmployee???????????????Employee???objEmployee???????
????//????objEmployee???????EmpInfo()????????????DervEmployee??????
????EmployeeobjEmployee=objDervEmployee;
????objEmployee.EmpInfo();
????}
????}
????}
?????????
????1.base???????????????з???????????????????????????????д??????????base??
??????????á?
????2.???????????????????????????base?????????????????????
????3.???base??????????????? ???????????????????????????????????????
???????????