An example of inheritance-related name hiding
/* C#: The Complete Reference by Herbert Schildt Publisher: Osborne/McGraw-Hill (March 8, 2002) ISBN: 0072134852 */ // An example of inheritance-related name hiding. using System; class A { public int i = 0; } // Create a derived class. class B : A { new int i; // this i hides the i in A public B(int b) { i = b; // i in B } public void show() { Console.WriteLine("i in derived class: " + i); } } public class NameHiding { public static void Main() { B ob = new B(2); ob.show(); } }