This
 
Hidden instance parameter passed to non-static member functions in a Type or Class

Syntax

This.fieldname
or
With This
.fieldname
End With

Description

This is a hidden parameter passed to all non-static member functions of a Type or Class. Non-static member functions are procedures declared inside the body of a Type or Class and include Sub, Function, Constructor, Destructor, assignment or cast Operator, and Property procedures.

The This parameter has the same data type as the Type or Class in which the procedure is declared.

Example

Type sometype
    Declare Sub MyCall()
    value As Integer
End Type

Dim example As sometype

'' Set element test to 0
example.value = 0
Print example.value

example.MyCall()

'' Output should now be 10
Print example.value

End 0

Sub sometype.MyCall()
    This.value = 10
End Sub


Differences from QB

  • New to FreeBASIC

See also