Revision [13151]

This is an old revision of KeyPgOpProcptr made by JeffMarshall on 2008-04-24 15:43:01.

 

Operator PROCPTR (Procedure pointer)


Returns the address of a procedure

Syntax:
Usage:
result = Procptr ( lhs )

Parameters:
lhs
A procedure.
T
The type of procedure.

Return Value:
Returns the address of the procedure.

Description:
This operator returns the address of a KeyPgSub Sub or KeyPgFunction Function procedure.
KeyPgOpAt Operator @ (Address of), when used with procedures, has identical behavior.

Examples:
' This example uses ProcPtr to demonstrate function pointers
Declare Function Subtract( x As Integer, y As Integer) As Integer
Declare Function Add( x As Integer, y As Integer) As Integer
Dim myFunction As Function( x As Integer, y As Integer) As Integer

' myFunction will now be assigned to Add
myFunction = ProcPtr( Add )
Print myFunction(2, 3)

' myFunction will now be assigned to Subtract.  Notice the different output.
myFunction = ProcPtr( Subtract )
Print myFunction(2, 3)

Function Add( x As Integer, y As Integer) As Integer
    Return x + y
End Function

Function Subtract( x As Integer, y As Integer) As Integer
    Return x - y
End Function


Dialect Differences:
See also:
Back to Pointer Operators
Back to Operators
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode