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
|
 |

|