The class module is an extended type. Besides attributes, there are also method events.
The module can have global (public) variables, global (API, constant, type) Declarations, Processes
Which has nothing to do with a specific form or controlCodePut it in another type of module-standard module (File Extension:. Bas. A process may be used to respond to events of several different objects. It should be placed in the standard module, rather than repeating the same code in the event process of each object.
Create objects using the class module (the file extension is. CLs) that can be appliedProgram. The standard module only contains code, and the class module contains both code and data, which can be considered as a control without physical representation.
The biggest benefit of a class module is encapsulation.
Class module can generate objects, such as dim A as mycls
A common module cannot generate objects. It can only be used as an extension of other modules, such as storing some global variables, global functions, and implementing some global functions.
If you use the same class function multiple times in the program and they are completely independent, you can consider using the class module.
If you want to do ActiveX dll or ActiveX EXE, remember to use the class module.
The class module is user-oriented in an object-oriented manner.
Setting a class is the most important thing in object-oriented design. Although VB does not support classes well, it can also be used, in the class module, you can set the methods and attributes of the class. For example, a class module called animal contains the public method eat, and the attributes include HP and MP, once you declare an animal object in other modules, you can use it. For example, if you declare a clslion class object, you can use clslion. eat (method), clslion. HP (attribute), similar to the self-contained objects in VB
The module stores global variables and functions for use by all modules.
--------------------------------------------------------------------------------
A module is a collection of things, and a class module is a collection of things that can be referenced as objects in the future.