Access Modifiers in C#

Access Modifiers specifies the scope of variable and functions in C#. The following are the access modifiers used provided by C#:


The public modifier sets no restriction on the access of members.


Access limited to the derived class or class definition.


The Internal access modifier access within the program that has its declaration.

Protected internal

It has both the access specifiers provided by protected and internal access modifiers.


Limited only inside the class in which it is declared. The members specified as private cannot be accessed outside the class.


Let us see an example of protected access modifier, accessing the protected members −

Live Demo

using System;
namespace MySpecifiers {
   class Demo {
      protected string name = "Website";
      protected void Display(string str) {
         Console.WriteLine("Tabs: " + str);

   class Test : Demo {
      static void Main(string[] args) {
         Test t = new Test();
         Console.WriteLine("Details: " +;


Details: Website
Tabs: Product
Tabs: Services
Tabs: Tools
Tabs: Plugins
karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know