Operator -> (Pointer To Member Access)
Returns a reference to a member from a pointer to an object
result = lhs -> rhs
lhs
Returns a reference to the member specified by rhs.
Operator -> (Pointer to member access) returns a reference to a member of an object through a pointer to that object. It has the effect of dereferencing a pointer to an object, then using Operator . (Member Access). For example, "p->member" is equivalent to "x.member", if x is an object of user-defined type and p is a pointer to an object of the same type.
This operator can be overloaded for user-defined types.
Syntax
Usage
result = lhs -> rhs
Parameters
lhs
The address of an object.
TA user-defined type.
rhsThe name of a member to access.
UThe type that rhs refers to.
Return Value
Returns a reference to the member specified by rhs.
Description
Operator -> (Pointer to member access) returns a reference to a member of an object through a pointer to that object. It has the effect of dereferencing a pointer to an object, then using Operator . (Member Access). For example, "p->member" is equivalent to "x.member", if x is an object of user-defined type and p is a pointer to an object of the same type.
This operator can be overloaded for user-defined types.
Example
Type rect
x As Integer
y As Integer
End Type
Dim r As rect
Dim rp As rect Pointer = @r
rp->x = 4
rp->y = 2
Print "x = " & rp->x & ", y = " & rp->y
Sleep
x As Integer
y As Integer
End Type
Dim r As rect
Dim rp As rect Pointer = @r
rp->x = 4
rp->y = 2
Print "x = " & rp->x & ", y = " & rp->y
Sleep
Dialect Differences
- Not available in the -lang qb dialect.
Differences from QB
- New to FreeBASIC
See also