ARTICLE

Using Component (Access Modifier Types) in ASP.Net: Part 9

Posted by Abhimanyu Kumar Vatsa Articles | ASP.NET using VB.NET August 09, 2010
This is my series of articles on ASP Components and in this article we will discuss different types of Access Modifiers.
 
Reader Level:

HTML clipboard

Introduction on Access Modifiers

Here is part 8

Basically Access Modifier is keyword which is used in class to allow or restrict the accessibility. Visual Basic supports the following access modifiers (also called access levels), which we can use when declaring a class, method, or property:

  • Public: A Public class, method, or property has no access restrictions.
  • Private: A Private class, method, or property can be accessed only within the class itself.
  • Protected: A Protected method or property can be accessed only within the class itself or a derived class.
  • Friend/Internal: A Friend class, method, or property can be accessed only by a component within the same assembly (dll file). Because ASP.NET pages are compiled into different assemblies than the contents of the App_Code folder, we cannot access a Friend member of a class outside of the App_Code folder.
  • Protected Friend/Protected Internal: A Protected Friend method or property can be accessed within the class itself or a derived class, or any other class located in the same assembly.

Using access modifiers is useful when we are developing a component library that might be used by other members of our development team or by self in future. For example, we should mark all methods that we don't want to expose from our component as private.

Note: Continue in Next Part.

HAVE A GREAT CODING!
 

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor