OverLoad. Hide new
<1>
Using System; using System. collections. generic; using System. linq; using System. text; namespace Test {class A {public void SayHello () {Console. writeLine ("I am the SayHello method of the parent class") ;}} class B: A {public new void SayHello () // subclass uses the new Keyword to hide the method of the parent class with the same name {Console. writeLine ("I Am a subclass of the SayHello method") ;}// condition for constructing method overloading: <1>: The function name is the same <2>: The parameter type is different, or the number of parameters is different // Note: different types of function return values are not judgment conditions for function overloading. Class C {public void Add (int a, int B) // The following four Add methods constitute a heavy load {Console. writeLine (a + B);} public double Add (double a, double B) {return a + B;} public void Add (int a) {Console. writeLine (a);} public string Add (string a, string B) {return a + B;} class Inheritance {static void Main (string [] args) {B B = new B (); B. sayHello (); Console. readKey ();}}}