C# Access Modifiers/Specifiers

C# Provides five types of access specifiers:

They are: Public, Private, Protected, Internal, Protected Internal

Public – It specifies that access is not restricted
Protected- It specifies that access is limited to the containing  class or in a derived class
Internal – It specifies that access is limited to the current assembly
Protected Internal – It specifes that access is limited to the current asembly or types from the derived class
Private – It specifies that acess is limited to the containing type

this video will surely help to understand:

Now lets see the example:
public:

protected:

output: it will show error

but we can show the output through some tricks

output:

Internal:

Protected Internal:

private:

eg 1:

eg 2: