VB5: Option Private Module vs Public 
Author Message
 VB5: Option Private Module vs Public

Quote:

>Actually, my understanding is that if you declare as Public, another
>app could create an object based on your app's class, and the variable
>would be visible.

True

Quote:
>Declaring as Public is used to share a variable among objects.  If I
>create a class X w/ a public variable Y, only one variable Y is
>created w/ the class, no matter how many instances of the class are
>created; all instances share the public variable Y.

No....  if you define a public or global variable in a BAS module then only
one copy exists (assuming you aren't mucking around with creating threads).
If you define a variable inside a class then every instance of the class has
it's own copy of the variable regardless of the public/private setting.


Thu, 18 Jan 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Option Explicit vs. Private/Public - Newbie

2. Public WithEvents Scope Limited To Module So Private?

3. Placing an control in a class module as public or private property

4. Option Private Module

5. Declaring variables as Static vs Private/Public -- XML

6. Private Resultset vs. Public Resultset

7. Public vs Private

8. Private vs Public functions & subs

9. Friend vs Private class and public

10. Private Resultset vs. Public Resultset

11. Public vs Private variables

12. Public vs Private Declairs

 

 
Powered by phpBB® Forum Software