protected access modifier c# code example
Example 1: what is a protected int c#
protected is useful when you want your class and all derived (child) classes to be able to access the method or variable, but you don't want it to be public.
Example 2: c# private public
public : Accès non restreint.
protected : Access is limited to the containing class or types derived from the containing class.
internal : Access is limited to the current assembly.
protected internal : Access is limited to the current assembly or types derived from the containing class.
private : Access is limited to the containing type.
private protected : Access is limited to the containing class or types derived from the containing class within the current assembly.