This refers to both functions and subroutines. A
Dim APerson As New CPerson( ) or: Dim APerson As CPerson = New CPerson( ) The first syntax is considered shorthand for the second. 3.3.5 Properties Properties are members that can be implemented in two different ways. In its simplest implementation, a property is just a public variable, as in: Public Class CPerson Public Age As Integer End Class The problem with this implementation of the Age property is that it violates the principle of encapsulation; anyone who has access to a CPerson object can set its Age property to any Integer value, even negative integers, which are not valid ages. In short, there is no opportunity for data validation. (Moreover, this implementation of a property does not permit its inclusion in the public interface of the class, as we have defined that term.) The “proper” object-oriented way to implement a property is to use a Private data member along with a special pair of function members. The Private data member holds the property value; the pair of function members, called accessors, are used to get and set the property value. This promotes data encapsulation, since we can restrict access to the property via code in the accessor functions, which can contain code to validate the data. The following code implements the Age property. Private miAge As Integer Property Age( ) As Integer Get Age = miAge End Get Set(ByVal Value As Integer) ‘ Some validation If Value < 0 Then MsgBox("Age cannot be negative.") Else miAge = Value End If End Set End Property As you can see from the previous code, VB has a special syntax for defining the property accessors. As soon as we finish typing the line: Property Age( ) As Integer the VB IDE automatically creates the following template: Property Age( ) As Integer Get
Note: If you are looking for cheapest and affordable webspace to host and run your servlet application check Astra servlet hosting services