public and private

BlitzMax Forums/BlitzMax Beginners Area/public and private

sswift(Posted 2006) [#1]
The help file and the examples on the forum I've found aren't much help here...

I keep seeing the following:

Public
Global A

Private
Global B

And it makes me wonder... Why would you put the word public or private on a seperate line?

Unless this means that everything after a public or private declaration is public or private?

So
Public
Global A
Global C

Private
Global B

Would have A and C public and B private. But then you'd probably have to have another Public after B so that your functions are public, unless you delcare them private?

It seems to me though that this probably is not the case. I mean people would probably just want to have the compiler assume everything is public, and then just go:

Private Global B

or

Private Function B()

to make one thing private.


So why do the examples I see of it in use put it on a seperate line above the item that the programmer wanted to make private? And why have a public command at all?


Maybe you can use both techniques? Putting it on the same line as a function of variable declaration does it just for that one, and putting it on a line by itself does it for everything that follows? Even if one of the items in the middle has it's own on the same line as it which denotes it should be the opposite?


Bremer(Posted 2006) [#2]
Everything that follows is either private or public until otherwise set.


sswift(Posted 2006) [#3]
Okay but what about this?

Public

Global VA
Global VB

Private Global VC

Global VD


Can I do that with VC? And will VD still be public?


Bremer(Posted 2006) [#4]
From what I know, VD will be private, you would have to have a public right after you declare VC if you want VD to be public.


FlameDuck(Posted 2006) [#5]
And it makes me wonder... Why would you put the word public or private on a seperate line?
Because that's the @#!*ty way C does it.


Dreamora(Posted 2006) [#6]
I think its better to have it on a seperate line to declare blocks and not like java where you need to rewrite it on every line!
In good objects there are more than 3 things in private and I sometimes get really p**** of rewriting private and public over and over again just because it can't "block"