public class A
{
protected int x = 123;
public static void Main()
var a = new A();
var b = new B();
// Error CS1540, because x can only be accessed by
// classes derived from A.
a.x = 10;
Console.WriteLine(a.x);
// OK, because this class derives from A.
b.x = 10;
}
public class B : A
public static void Main2()
//a.x = 10;