The protected keyword is a member access modifier. A protected member is accessible within its class and by derived class instances.
Example
A protected member of a base class is accessible in a derived class only if the access occurs through the derived class type. For example, consider the following code segment:
C#
class A
{
protected int x = 123;
}
class B : A
{
static void Main()
{
A a = new A();
B b = new B();
// Error CS1540, because x can only be accessed by
// classes derived from A.
// a.x = 10;
// OK, because this class derives from A.
b.x = 10;
}
}