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

 

'Define the termination subroutine

Private Sub Class_Terminate

 

'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

Object Hierarchy

Object List