What are the access-specifiers available in c#?

Answer Posted / anupam dixit

1. Public: Any member declared public can be accessed from
outside the class.

2. Private: it allows a class to hide its member variables
and member functions from other class objects and function.
Therefore, the private member of a class is not visible
outside a class. if a member is declared private, only the
functions of that class access the member.

3. Protected: This also allows a class to hide its member
var. and member func. from other class objects and
function, except the child class. it becomes important
while implementing inheritance.

4. Internal: Internal member can be expose to other
function and objects. it can be accessed from any class or
method defined within the application in which the member
is defined

5. Protected Internal: it's similar to Protected access
specifier, it also allows a class to hide its member
variables and member function to be accessed from other
class objects and function, excepts child class, within the
application. used while implementing inheritance.

Is This Answer Correct ?    126 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What exception can an overridden method throw in comparison with the method it is overriding?

450


What does return do in unity?

528


What is the example of predicate?

490


What is c# best for?

513


What is the extension of c# file?

430






What is the difference between string and string in c#?

457


List the differences between method overriding and method overloading?

475


Which property of the textbox cannot be changed at runtime?

470


What do u mean by delegation?

526


Can abstract class have parameterized constructor?

487


Why would you use untrusted verification?

526


Explain about c# language.

588


Explain the difference between event and a delegate in c#?

522


Is it possible to have different access modifiers on the get/set methods of a property in c#?

582


What is sqldatareader c#?

474