• Welcome to Dark Bit Factory & Gravity.
 

Difference with a Private Sub / Function

Started by Clyde, May 02, 2006

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Clyde

Anyone know what the difference between using a sub or function with or without Private before it is used for please? And Is there any benefit with using it?

For example:


Sub ( ByVal x As Integer, ByVal y As Integer, ByVal c as Integer )
         'Dummy Sub
End Sub


Or:


Private Sub ( ByVal x As Integer, ByVal y As Integer, ByVal c as Integer )
          'Dummy Sub
End Sub



Cheers and many thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Rbz

QuoteSyntax

PRIVATE sub/function name


Description

Explicitly sets an individual sub/function to be private (instead of PUBLIC by default). This means the sub/function is only accessible within the module and is hidden to other modules. This means two subs/functions can have the same name, as long as they are private and are in seperate modules.

Subs/functions are private by default if the command OPTION PRIVATE is used, otherwise they are public by default.


If you have coded 2 librarys (*.bi) and if they use same name for one function/sub you can make those functions private for each separated module (.bi file).

QuoteAnd Is there any benefit with using it?

Maybe, but I never used it until today :(
Challenge Trophies Won:

Clyde

So it's like having a local subroutine / function for seperate includes, so it cant be used by other source listings that are shared.

Cheers Rbraz.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won: