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

Free Components

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 Get

The Property Get statement declares a property for an object within a Class definition. It allows the person who creates an instance of the class to retrieve a property of the class.

You should use Property Get 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.

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, San Diego Web Design

ASP Nuke CMS
Free Open Source
Content Manager
GoSwap Auctions
Buy, Sell
No Fees!

Contact Us | Contribute | About | Site Map



"It is better to deserve honors and not have them than to have them and not deserve them." - Mark Twain

©2012 San Diego Web Design - Orvado Technologies, All Rights Reserved
ASP Nut provides articles and reference documentation for Active Server Page developers.