Type Dependencies

BlitzMax Forums/BlitzMax Beginners Area/Type Dependencies

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

if the array's a Global you should be able to get to it from inside a Type...

Well my Type is in a separate file so it won't build because it doesn't know the array. I think there is a way to define the array as EXTERN or something. Haven't looked into it. I like my types to be as independent as possible though.

If you dson't want the array to be global (easiest) I'd make a pointer to it in the type an initialise it early on.

That is the way I am tending to go although I haven't worked with BM pointers and such yet. I like it though. Objective C uses that approach a lot.

I know I could pass the array in as a parameter to my Player methods but I don't like that.

Why not? That sounds like a perfectly suitable solution to me...

I only like to pass parameters to a method if I will be calling the method with different values for the parameters. In this case I would be passing the same array every time. The fact that the method will always operate on the same array should be built into the method .