This example creates a custom object class called Hello and adds a function method called SayHello. The SayHello method returns the character string "Hello World" which is displayed by the MESSAGEBOX function. Note: The class definition code is placed after the program code that instantiates the object.
Local oHello
oHello=CREATEOBJECT("Hello")
=MESSAGEBOX(oHello.SayHello(),48)
RELEASE oHello
* Class definition code
DEFINE CLASS Hello AS CUSTOM
FUNCTION SayHello
RETURN "Hello World"
ENDFUNC
ENDDEFINE