Saturday, January 09, 2016

What are the different types of access specifier in VB.Net ?

Solution:-

Access specifiers describe the accessibility scope of a variable, method or a class. By using access specifiers we can control the scope of the member object of a class. Access specifiers were used for providing security of our applications. In Visual Basic .Net there are five access specifiers and they are as follows:

Public:-
             It have no restriction on accessibility. We can use the public members from any were inside the class or outside the class.

Private:-
              Their accessibility scope is limited to only inside the class in which they are declared. We can't access the Private members from outside the class and it is the least permissive access level.

Protected:-
              The protected members have scope of accessibility within the class and classes derived(Inherited) from that class.

Friend:-
           Friend members have the accessibility scope from the same assembly and program that contain their declarations.

Protected Friend:-
            It behave like both protected and friend access specifiers. We can access the protected friend member from anywhere in same assembly and the classes inherited from the same class.