Creating an object is handled by the "New" operator (syntax: "Local o:MyType = New MyType"). You can access its variables and member functions with the dot operator (syntax: "o.xPos = 10.5 ; o.yPos = 12.6 ; o.normalise(17)").
Objects can in fact only be created while the program is running. There's no such thing as an "object literal" in BlitzMax: you have to use New, or a function that in turn calls New at some inner level (OK, there is also a special syntax for creating and filling arrays, but that's still dynamic even though it has syntax support; and you don't need to think about that right now).
There is no special way to delete an object again. This is the work of the garbage collection system, which will clean up an object once it has detected it is no longer in use.
Last edited 2012
|