chris319 wrote:Example, please?
For example
Code: Select all
Class foo
Public Method bar()
Debug "hello!"
EndMethod
EndClass
*foo.foo = NewObject.foo
CallFunctionFast( *foo\bar, *foo )
the first argument of the method called by CallFunctionFast (*foo), is mandatory, because it will become the *This pointer used by the method. This is needed for the SimpleOOP preprocessor to work correctly, and for the PureBasic compiler to allocate the right amount of memory for the procedures, otherwise memory errors will occur in the program. If the method contains parameters, these can be added after the *foo one.
While this example doesn't really show anything useful, using pointers to reference methods inside objects enable event-driven programming to be used together with SimpleOOP objects and methods. This is really the top of both worlds. I'm easily building a GUI framework and it's working flawlessly.