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 is bit in c#?

524


Is c# good for beginners?

471


What is data binding c#?

522


Are c and c# the same thing?

484


How to transpose multi-dimensional array?

556






What is different between Static Constructor and Private Constructor?

461


Why do we use overloading in c#?

475


What is the difference between IEnumerator and IEnumerable?

674


Explain About Assembly in .NET, types of assemblies, their difference, How to register into GAC. How to generate the strong names & its use.

590


Can you specify nested classes as partial classes?

508


What is c# used for?

511


What is CLR and its application.?

560


Where do we use static class in c#?

487


Explain about CTS?

544


Explain About delegates

592