VBS tutorial: VBScript statement – class statement

Time:2022-1-6

Class statement

Declare the name of a class and the definitions of the variables, properties, and methods that make up the class.

Class name
    statements
End Class

parameter

name

Required.ClassThe name of the; Follow standard variable naming conventions.

statements

Required. One or more statements that defineClassVariables, properties, and methods.

explain

stayClassIn the block, members are declared asPrivateorPublic。 Declared private will onlyClassWithin the block is visible. Declared public not only inClassThe inside of the block is visible, rightClassCode outside the block is also visible. Not usedPrivateorPublicExplicitly declared are defaulted toPublic。 Declared inside a block of a class asPublicProcess of(SuborFunction)Methods that will become classes.PublicThe variable will become an attribute of the class, the same as usingProperty GetProperty LetandProperty SetProperties that are explicitly declared are the same. The default properties and methods of classes are used in their declaration sectionDefaultKeyword. Refer to the separate declaration topic for how to use this keyword.

requirement

Version 5