26 Sep 2017

what is access modifier in c# with example


what is access modifier in c# with example:-

Access modifiers is a keyword ,it is use to declare accessibility  a class and data member & member function and constructor .

How many types of  access modifier

There are 5 type of access modifier:-


1.Private.
2.Public.
3.Internal.
4.Protected.
5.Protected Internal.

Private:-Private access modifier used with in class.


Public:-Public access modifier can be accessible in a class and outside of class and we and use to before a class and before a method.


Internal:- Internal access modifier can be used to before a class. And Internal access modifier can be used to same project anywhere.
but We can't use out side of project.

Protected:- Protected members in a base class it is accessible in the drive class.


Protected Internal:- Protected Internal modifier can be accessible from any class with in same assembly,and it is inclused   the derived  class.

2 comments:
Write comments

Contact Form

Name

Email *

Message *

© 2014 Rock Programmer . Designed by Bloggertheme9
Powered by Rock Programmer.