Method?
BlitzMax Forums/BlitzMax Beginners Area/Method?
| ||
The docs are quit basic at some points. Would somebody please be so kind to explain, what exactly "methods" are?? Thanks :) |
| ||
Methods are functions within a type - they are unique to each object instance. They are the same thing as member functions in C++. |
| ||
Ah, thanks a thousand times. So, I use "methode" same as "function", just within a type. Have to try this, sounds promessing. |
| ||
Yeah, exactly. And, BTW, using "function" within a type is the same thing as declaring a static member function in C++. |
| ||
I don't know anything about C++, but I THINK I know what it means. :) |
| ||
Static just means that you don't have to have an object instance to call the function ... you just have to have the type name.type MyType function MyFunction() end function end type ... MyType.MyFunction() It's a way to organize functions somewhat. Not REALLY all that useful but, hey, there it is... |
| ||
I've found that static methods are really useful for doing initializers and such. For example:Type Foo Function Create:Foo() F:Foo = New Foo F.DoInitStuff() Return F End Function Method DoInitStuff() 'Whatever End Method End Type F:Foo = Foo.Create() |
| ||
True. They do have their uses... |