What am I doing? :- /

BlitzMax Forums/BlitzMax Beginners Area/What am I doing? :- /

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.

I'm tired, so I may be rambling a bit:

A function is global to the type rather than the instance of that type, it can be called without there being an instance of the type, which is why it's handy for Creating the type.

i.e.
type TmyType
    Field _Count:Int
    Field _X,_Y:Int

    Method Reset() 'this cannot be called until a type has been instantiated, and then it is only local to the type.
      _X = 200
      _Y = 200
      _Count = 0
    End Method

    Function Create:TmyType(x,y,count)'create a new instance of this type and return it
    local temp:TmyType = new TmyType
        temp._X = x
        temp._Y = y
        temp._Count = count
    return temp
    End Function
End Type
global myNewType:TmyType = TmyType.Create(10,10,100) 'this works fine
global myNewType2:TmyType
myNewType2.Reset() 'this will not work since myNewType2 is still null (it has not been instantiated).