Ok, what is the REAL difference between method....

BlitzMax Forums/BlitzMax Programming/Ok, what is the REAL difference between method....

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.

So, could it be said basically that methods() are 'local', while functions() are 'global'? And further, new memory is allocated for each Method when a new instance of an object is created, whereas only one copy of a function needs to occupy memory and they all use that?


No it couldn't be said. :)

Methods will have only one copy of the code, just like functions. Even if you make 1 million instances (objects) of a Type.

Basically, Functions cannot access Fields nor Methods in a Type, because they are not working with an Object. They can access other Functions, Const's and Global's of a Type though because none of those actually require an object to work.


Aaron