xxxxxxxxxx
public class MyBaseClass
{
protected int _myProtectedField;
protected void MyProtectedMethod()
{
// code here
}
}
public class MyDerivedClass : MyBaseClass
{
public void DoSomething()
{
_myProtectedField = 42; // accessible within derived class
MyProtectedMethod(); // accessible within derived class
}
}
xxxxxxxxxx
The protected keyword is used with inheritance to acess/modify a attribue in a base class