-
I just wanted to know...
What exactly is a Class Module? and How does it differ from a BAS Module?
(I need a new thing to start learning so I figured why not Class Mods)
(and if anyone feels up to it...post some code for some simple class modules and maybe how to implement them)
Thanks!
-
The idea with Object Orientation is to encapsulate code into Classes which will act as a blueprint for objects. Objects are way to group components and properties, and methods that are put together as an abstract entity. If you already know, user defined types (UDT) are way of doing this, grouping variables into one entity you can work with and pass around as one variable. The difference between them and Classes are that you group methods to act as a interface for the variables. You can't really compare standard module with Classmodules. They are both code repositories but standard module code is global within the project. The classmodules although you have to access them by their name as objects, they can be shared and passed between projects, if you put them in ActiveX Dll's or Exe's.
There is still much to say about Object Orientation in general, but i'm sure you wouldn't want to have it all at once. There's many topics around the forums about classmodules if you want to read later, you could just search on the topic.
-
cool...
Thanks fors the 'quick' overview...I think I am grasping the idea behind it.
Thank you very much!
(The UDT was the perfect way to describe it...I understood that)
-
-
I found the com course part one a very clear and very easy intro to Classes, check it out and make your own dog class step by step including Enum and Event:
http://www.vb-world.com/activex/comcourse/
-
good stuff..
-
Dont forget though that true OOP will allow inheritance, polymorphism and encapsulation. VB does not have inheritance and its polymorphism sucks. They have just implemented the easy bit. Try Delphi - that really is OOP.
P.