protected C# with Example
The protected keyword marks field, methods properties and nested classes for use inside the same class and derived classes only: public class Foo() { protected void SomeFooMethod() { //do something } protected class Thing { private string blah; public int N { get; set; } } } public class Bar() : Foo { private void someBarMethod() { SomeFooMethod(); // inside derived class var thing = new Thing(); // can use nested class } } public class Baz() { private void someBazMethod() { var foo = new Foo(); foo.SomeFooMethod(); //not accessible due to protected modifier } }