Defining Object Properties and Methods

 

Class and object modules define the properties and methods of objects. To define the methods for an object, simply define public subroutines and functions. All the public procedures in a class or object module are methods that users of the object can call.

The properties of an object typically correspond to private global variables defined in the module. To allow users of the object to access the variable values, you provide "property get" and "property set" procedures. Use the Property Get statement to define a function that returns the value of a property. Use the Property Let statement (or the Property Set statement if the property is an object reference) to define a subroutine that changes the value of a property.

Two special subroutines are called when an object is first created and just before it is finally destroyed. In a class module, these subroutines are called "Class_Initialize" and "Class_Terminate".

See Also

Module Types

The '#Uses Line

Private and Public Definitions

Module Properties

Class Module Example

Scripter BASIC Language

Object Hierarchy

Object List