Home  |  Latest News  |  Contribute  |  F.A.Q.  |  Account  |  Scripts | About
Search ASPNut:
 
ASP Reference
Server Variables
ASP Glossary
Related Sites

Free Components

HTML Reference
Web Colors
Entities
CSS Level 1
Encode/Decode
Glossary

Our Sponsors
ASP Nuke CMS
Free Auctions
PHP 5 Script
Funktastic Blog
ULost Directory
Team Task

 

 

 

 

 

 

 

 

 

 

 

 

Property Let

The Property Let statement allows you to declare an accessor method for an object within a Class definition. An accessor method allows the person who creates an instance of the class to retrieve information (properties) for the object without directly accessing the member variable itself.

You should use Property Let as opposed to Public member variables wherever possible. This is just a good rule-of-thumb when creating objects since it abstracts the data from the object. If you decide later that you want to put tighter controls on the member variable, you will be glad that you used a property because you won't have to change the interface to the object.

When a Property Let statement is defined, the user of the object may set a value for that property. Conversely, the Property Get statement allows a user to read a value for the property. It is okay to use the same name for the Let, Get and Set properties.

Class Person
    ' demonstrates how you can control access to a private variable     Private m_nAge        ' age of the person
    Property Get Age()
        Age = m_nAge
    End Property

    Property Let Age(nAge)
        If nAge >= 0 And nAge < 120 Then m_nAge = nAge
    End Property
End Class

Orvado Technologies

ASP Nuke CMS
Free Open Source
Content Manager
HomeFix Boards
Home Remodeling
Message Boards

Contact Us | Contribute | About | Site Map



"I like to listen. I have learned a great deal from listening carefully. Most people never listen." - Ernest Hemingway

©2007 Orvado Technologies, All Rights Reserved
ASP Nut provides articles and reference documentation for Active Server Page developers.