Hi, my self Ravi Vishwakarma. I have completed my studies at SPICBB Varanasi. now I completed MCA with 76% form Veer Bahadur Singh Purvanchal University Jaunpur.
Access Specifiers in OOP : Access specifier is used to access data members methods and fields of a class in other derived class in different way. There are five types of access specifiers are used in C# programming language which are as follow-
1- Public
2- Private
3- Protected
4- Internal
5- Protected Internal
But in 7th version of C# there is one more access specifier is add which is 'Private Protected'
Public: The members and methods has no limits to access it in same class or outside of this class which is defines as 'public'.
Private: Private access specifier did not allow to access the members and fields outside of that class means which methods, variables and properties declare as private then it is accessed within that same class not in its derived class nor in other files.
Protected: Its accessibility is only within the same class and its derived class. we can say that which methods, variables and properties of a class is declare as protected then it accessed in same class or its derived (child) class.
Internal: Which methods or fields declare as internal then it is accessible in assembly of that class or project. Generally an assembly creates the .dll files and .exe files in c# programming language.
Protected Internal: This types of access specifier is has same property like protected and internal have. which methods and fields are declare as protected internal then it can be accessed in its assembly as well as in its child assembly.
Liked By
Write Answer
What are ‘access specifiers’ in OOPs programming concepts?
Join MindStick Community
You have need login or register for voting of answers or question.
Ashutosh Kumar Verma
26-Aug-2021Access Specifiers in OOP : Access specifier is used to access data members methods and fields of a class in other derived class in different way. There are five types of access specifiers are used in C# programming language which are as follow-
1- Public
2- Private
3- Protected
4- Internal
5- Protected Internal
But in 7th version of C# there is one more access specifier is add which is 'Private Protected'
Public: The members and methods has no limits to access it in same class or outside of this class which is defines as 'public'.
Private: Private access specifier did not allow to access the members and fields outside of that class means which methods, variables and properties declare as private then it is accessed within that same class not in its derived class nor in other files.
Protected: Its accessibility is only within the same class and its derived class. we can say that which methods, variables and properties of a class is declare as protected then it accessed in same class or its derived (child) class.
Internal: Which methods or fields declare as internal then it is accessible in assembly of that class or project. Generally an assembly creates the .dll files and .exe files in c# programming language.
Protected Internal: This types of access specifier is has same property like protected and internal have. which methods and fields are declare as protected internal then it can be accessed in its assembly as well as in its child assembly.