|
-
October 15th, 1999, 09:08 AM
#1
need help
Hi,
does anybody know if the next sentence is correct in a class module:
Public aVariable1,aVariable2
and if it is correct, "aVariable2" is also public or not.
Thanks to all.
MARC
---------
-
October 15th, 1999, 09:20 AM
#2
Re: need help
*the* way to find out is to try it.. :-)
But yes, both are Public...
Crazy D @ Work :-)
-
October 15th, 1999, 01:09 PM
#3
Re: need help
As the previous response said, both are public. But I would STONGLY suggest not writing such a line. For instance (and you may have omitted this in haste), in the line you have used as an illustration, both variables are implicitly declared as the default type (since VB 4.0, a Variant) unless you have included a DefInt, DefLng, etc. statement, in which case both variables will take that declared default type, if applicable. This may not result in the data type you wanted. And, are you trying to save linefeeds? I would recommend extra precision:
public AVariable1 as Integer
public AVariable2 as Long
This is not only less subject to such confusion as to whether or not each variable is Public, but the types are not in doubt, and--six months from now, when you look at your own code--you'll be glad you took the time (and the linefeeds) to be precise.
Reid Allen Robbins
2205 E. Teton Blvd.
Green River, WY 82935
-
October 16th, 1999, 03:47 AM
#4
Re: need help
It actually doesn't take "much time" too :-)
if Intellesense is 'On', VB will anyway prompt you with "types", as soon as you type the word "as". I can't think, someone will be coding with that setting 'Off'.
RK
-
October 16th, 1999, 04:12 AM
#5
Re: need help
Thanks for your precission,
I'm developing a Visual Basic compiler and I need to know if these kinds of constructions are correct
and if they are what happens with the variables scope I know that the example I gave wasn't so precisse
but I must think about the possibility of have code like that.
Thank you very much.
MARC.
--------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|