DEFINE CLASS Command

Creates a user-defined class or subclass and specifies the properties, events, and methods for the class or subclass.

Caution noteCaution

Modifying read-only properties from base classes generates an error message.

The full syntax for the DEFINE CLASS main clauses appears as follows:

DEFINE CLASS ClassName1 AS ParentClass [OF ClassLibrary] [OLEPUBLIC]
   [[PROTECTED | HIDDEN] PropertyName1, PropertyName2 ...]
   [[.]Object.]PropertyName = eExpression ...]
   [PEMName_COMATTRIB = nFlags | DIMENSION PEMName_COMATTRIB[numElements]
      [PEMName_COMATTRIB[1] = nFlags
              PEMName_COMATTRIB[2] = cHelpString
              PEMName_COMATTRIB[3] = cPropertyCapitalization
              PEMName_COMATTRIB[4] = cPropertyType
              PEMName_COMATTRIB[5] = nOptionalParams]]
   [ADD OBJECT [PROTECTED] ObjectName AS ClassName2 [NOINIT] [WITH cPropertylist]]
   [IMPLEMENTS cInterfaceName [EXCLUDE] IN TypeLib | TypeLibGUID | ProgID ]
   [[PROTECTED | HIDDEN] FUNCTION | PROCEDURE Name[_ACCESS |_ASSIGN]
      ([cParamName | cArrayName[] [AS Type][@]]) [AS Type]
      [HELPSTRING cHelpString] | THIS_ACCESS(cMemberName) [NODEFAULT]
            cStatements
   [ENDFUNC | ENDPROC]
ENDDEFINE

Expand imageRemarks

Expand imageExamples

Expand imageExample 4

Expand imageSee Also


© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic