Can somebody tell me what classes and class-modules are?
What good do they do? When should I use them?
D
Printable View
Can somebody tell me what classes and class-modules are?
What good do they do? When should I use them?
D
Classes are like User Defined types with code, also
Classes are like standard modules that can be instanced ;)
What i meant with that is that classes are the blueprint to objects, as for instance command button control is the blueprint to Command1 or Command2. You design classmodules for several purposes
1. To make abstract concepts more clear and oriented to objects, that's called object orientation
2. To wrap other objects or modules, or Standard Dll's or whatever.
3. To create a hieararcy of objects and classcollection so that for instance your ActiveX project will look more professional and easy to use.
Classmodules are very flexible if you compare to UDT's you can make your custom functions and subs attached to them and operate the propeties from outside the class. If you compare to standard modules, you can both have one instance of the object and use it as a standard module, and then unload it whenever you want to unload all variables. You can also use classmodules for several objects to have the same propeties but with independent values.
See This topic.