C # base keyword,
1. The base keyword is used to access the members of the base class from the derived class.
2. Call methods that have been overwritten by other methods on the base class.
3. Specify that the instance for creating a derived class should call the constructor of the base class.
4. Public and protected members accessing the base class cannot access private members.
5. It is incorrect to use the base keyword in a static method ..
In the following example, both the base class Person and the derived class Employee have a GetInfo () method. The base keyword can be used to call the GetInfo () method of the base class from the derived class.
Class TestBase {static void Main () {Employye employee = new Employye (); employee. getInfo (); Console. read () ;}} public class Person {public string Name = "jing"; public int Age = 20; public virtual void GetInfo () {Console. writeLine ("Name: {0}, Age: {1}", Name, Age) ;}} public class Employye: Person {public string Id = "123456 "; public override void GetInfo () {base. getInfo (); Console. writeLine ("employee Id: {0}", Id );}}