Click to See Complete Forum and Search --> : What is a Class Module?
Zej
Jan 21st, 2000, 04:16 AM
Can someone explain to me (in regular english) what a class module is? and what it does?
Brent Akester
Jan 21st, 2000, 05:03 AM
There's no short answer to this, really...
Class modules are what create objects at run-time. A Class module is a special module that allows you to expose ONLY those properties, methods and events that you WANT exposed to other parts of your program, and 'hides' (encapsulates) the rest of your code that you don't want Public.
Class modules are the foundation of COM, DCOM, and the whole concept of code reuse. Also, Class modules allow you to create multiple objects from the same class, BUT each and every one of those objects has its OWN unique data, completely independent from the other objects that were created from the same class.
I STRONGLY encourage you to check out these MSDN articles:
http://msdn.microsoft.com/library/partbook/vb5bo/objectsclasses.htm
http://msdn.microsoft.com/library/techart/ifacebased.htm
They're both excellent, and will help you gain a basic understanding. You might also consider picking up a few books. I recommend 'Beginning Visual Basic 6 Objects' by Peter Wright (published by Wrox Press).
Programming with objects will change your life :) Good luck!
I heard a good analogy to visualise....
a class module is the cookie cutter, you describe through code what the cookie cutter looks like. you then use the cutter to create several identical "cookies" (nothing to do with the internet). thats how i like to think of classes!
------------------
Wossname,
Email me: wossnamex@talk21.com :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.