Crouching Functions Hidden Methods

BlitzMax Forums/BlitzMax Programming/Crouching Functions Hidden Methods

TeraBit(Posted 2008) [#1]
I'm a little fuzzy on this issue with Blitz.

Is there no way to hide Methods / Functions in BlitzMax from outside the type (i.e. Private Methods / Functions)?


Who was John Galt?(Posted 2008) [#2]
No. A kind of assumed convention seems to be to stick an underscore in front of private fields, guess you could do the same for private methods e.g.

_private_method()


Matthew Smith(Posted 2008) [#3]
Terabit,

I think you can do this:




TeraBit(Posted 2008) [#4]
Thanks for the info. :)


Who was John Galt?(Posted 2008) [#5]
Sorry for the disinfo, Terabit! It's new to me. Has that functionality always been there, Matt?


Gabriel(Posted 2008) [#6]
I don't think you did provide disinfo, John. I tried Matt's code ( because I also believed what you believed ) and it throws a "Syntax error in User Defined Type" error, which is exactly what I thought it would do.


Yan(Posted 2008) [#7]
John is quite correct and I think Matt just misunderstood the question.

You can't make individual methods/functions of a type private. You can only make entire types private/public.


Perturbatio(Posted 2008) [#8]
you could extend a private type in the public scope of the same code file... I think


tonyg(Posted 2008) [#9]
I think Matt is correct in what he said although it doesn't answer the original query.
Import "hello_world_private.bmx"
hello()
world()

with hello_world_private.bmx =
Private
Function hello()
	Print "hello"
End Function
Public 
Function world()
	Print "World!"
End Function