Faqts : Computers : Programming : Languages : Visual basic

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

76 of 98 people (78%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

What's the difference between modules and class modules?

Mar 13th, 2004 14:38
Washington Corrêa, Maggie Chao,


With class modules you can create instances and with modules you can't.
Example:
Dim k as new classmodule
k.variable = 3
dim j as new classmodule
j.variable = 5
module.variable = 6
debug.print k.variable
debug.print j.variable
debug.print module.variable
Both "k" and "j" are "objects" (instances of a class), and both have a
variable named "variable". This variable will have different values in
"k" and "j". In the case of a module you'll be allowed to change only
*one* variable (not different copies of it).