Class Module Example

The following class module demonstrates how to define an object. The sample defines a property named Radius and a method named Draw.

 

'Declare a private global variable for

'storing the property called "Radius"

 Dim cirRadius As Double

 

'Define the initialization subroutine

 Private Sub Class_Initialize

   cirRadius = 99

End Sub

 

'Define the termination subroutine

Private Sub Class_Terminate

End Sub

 

'Define the "property get" function to

'retrieve the Radius property

Property Get Radius() As Double

   Radius = cirRadius

End Property

 

'Define the "property let" procedure to

'change the Radius value

Property Let Radius(val As Double)

   cirRadius = val

End Property

 

Sub Draw

   'Method performs some action here

End Sub

 

 

See Also

Module Types

The '#Uses Line

Private and Public Definitions

Module Properties

Defining Object Properties and Methods

Scripter BASIC Language