Arrays in User-Types

BlitzMax Forums/BlitzMax Programming/Arrays in User-Types

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 you mean that Max can't create objects on the stack, then no it can't. Nor can Java. In fact, Max's object model is very similar to Java's (although with the advantage that you can tell when the garbage collector is going to operate).

Also, your C++ example isn't memory managed. Even smart pointers in C++ (std::auto_ptr, boost::shared_ptr etc.) can't be used with objects created on the stack. To use memory management you have to create memory on the heap, just like Max, using New (or malloc or whatever).

People refer to Types as "classes" because Type definitions work just like C++/Java class definitions and hold all the properties that you'd normally associate with a "class". Likewise, people call Max's references "references" because they are references, not pointers. Pointers in Max are different beasties. An unititialised reference is still a valid reference, it's just a reference to Null.