using System;
public class A
{
public int x;
protected int y;
private int z;
}
public class B:A
private int d;
protected int e;
public void Foo()
x=2;
y=2;
d=2;
e=2;
public class Program
public static void Main()
B b=new B();
b.x=1;
//It's OK to define public z in class B, but there will be warnings if I define public x and y.
//The warning says 'B.x hides inherited member A.x'.
//As we know a derived class can access both public and protected members of the base class.
//If you define it again, it is just like that you want hide their original values and give them new lives.
//As for z, it is a private integer and it cannot be accessed in class B, so it's fine to define z again.