-
Don't mean to stir things, cause arguments between you all, but 2 things:
I use Private & Public statements at the moment, is there any advantages with any of the others, and why is it so bad to use the global statement?
Secondly, I also use modules, but cannot see a use for the class objects, can someone please give me an example of why I would choose this over a module, the point of it?
Thank you everyone, I have always wanted to know these, I do not use them, and cannot see the point at the moment (you will probably sset me straight here though).
Alex Read
-
You wrote:
"I use Private & Public statements at the moment, is there any advantages with any of the others, and why is it so bad to use the global statement? "
What others?
Globals? --> Public is Global - sort of.
Using Classes allows you to create instances and call the methods using simple ClassName.Method notation. It also allows Data Hiding to a certain extend. There is much more to it than this, but would take more than 3 paragraphs to explain.
You are right in that this is not really Object Oriented Programming, although some might try and argue that it is. Wait for VB7 which promised Encapsulation, Inheritance, Polymorphism, Overloading etc (see MS web site).
I cannot wait.
-
reply 2 reply
Global & Static are two more scopes, there was another like global beginning with P that I read about a while back, but have forgotten, I just cannot see any advantages with these in the MSDN collection & was hoping for some of your views on the subject.
Also, if the cls object is not that easy to explain, is there any references ie-sites I could check this out on?
Thank you!
Alex Read
-
The only difference between Global and Public is that you cannot use Global inside any classes, only in standard modules. In other words there is no use of Global.
Static can be used as variable inside a procedure which does not unload itself like Dim when exiting it. Once a static variable is initialized, it lasts until the class or application unloads.