What is the meaning of the planned "private protected" C# access modifier?
Here are all access modifiers in Venn diagrams, from more limiting to more promiscuous:
private
:
private protected
: - added in C# 7.2
internal
:
protected
:
protected internal
:
public
:
According to "Professional C# 2008" by De Bill Evjen and Jay Glynn, page 1699:
private protected - "only derived types within the current assembly"
C++/CLI has a similar feature - Define and Consume Classes and Structs (C++/CLI) > Member visibility:
private protected
-or-protected private
- Member is protected inside the assembly but private outside the assembly.
This is just to provide a graph (made with http://ashitani.jp/gv/) of the different accessibility levels (images do not fit in comments).
Each arrow means "is more restrictive than".
The CLR names are Private
, FamilyANDAssembly
, Assembly
, Family
, FamilyORAssembly
, Public
.
Much later edit: It turned out this nice new access level (with a really poor name) was not eventually included in C# 6.0. It is supported only from C# 7.2 (and I see you updated your question "tags").