Access modifiers in C# 7.2
January 22, 2018 Leave a comment
C# 7.2 comes with a new access modifier “private protected”. It sounds like a weird combination so let’s see how the various access modifiers in the current release of C# work.
Let’s start with an abstract class called Animal:
public abstract class Animal
{
private String privateName = "Private name";
protected String protectedName = "Protected name";
protected internal String protectedInternalName = "Protected internal name";
private protected String privateProtectedName = "Private protected name";
public String publicName = "Public name";
}