C#???????д??????
???????????? ???????[ 2016/8/8 16:16:13 ] ???????????? ??д
???????????????
????1.??????????????2.?????????????3.?????б?????????
??????д????????
????1. ??????????
????2. ??????????д??????????????????????????????б??????????
????3. ?????????????????????????????????????
????4. ?????????????????????????????????????public??package??protected?? private??
????5.?????岻?
????super()?????????super.?????????????????
????this()????????????????????this.????????????????
??????????????вι???????????幹????
????????:
????????????????????У????????????????????з???????????????????????????????????????????????????????????????μ????
class OverLoadTest
{
public void Hello()
{
}
public void Hello(string str)
{
}
public string Hello()
{
}
}
????????δ??????????????????????????Hello???????????????????????????????????????????????У???????????????????в???????????????????????????????з???????????????C# ?????????????????????“???????????"Hello"?????”?????
??????д:
??????д???????м?й?????????
??????д??????????????????override?????????д???丸???й???????????????????????????????б???????
class Program
{
static void Main(string[] args)
{
OverWriteTestTT owTT = new OverWriteTestTT();
owTT.Hello();
overWriteTestTTT owTTT = new overWriteTestTTT();
owTTT.Hello();
}
}
class OverWriteTest
{
//Over write the method ToString();
public override string ToString()
{
return "hello world";
}
//Define a virtual method Hello() to be over written
public virtual void Hello()
{
Console.WriteLine("hello");
}
}
class OverWriteTestTT : OverWriteTest
{
public override void Hello()
{
Console.WriteLine("No hello world");
}
}
class overWriteTestTTT : OverWriteTestTT
{
//Over write the method Hello() of class OverWriteTestTT
public override void Hello()
{
base.Hello();
Console.WriteLine("NNo hello world");
}
}
??????
???·???
??????????????????
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