Skip to content

Commit 52583d0

Browse files
Shati Pateljames
authored andcommitted
QL HB: Explain use of cast [SD-3865]
(cherry picked from commit f5de1dc)
1 parent ab77d02 commit 52583d0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/language/ql-handbook/types.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ predicate from the :ref:`above <defining-class>` class::
147147

148148
1.(OneTwoThree).getAString()
149149

150-
This call returns the results ``"One, two or three: 1"``.
150+
This call returns the result ``"One, two or three: 1"``.
151+
152+
The expression ``(OneTwoThree)`` is a :ref:`cast <casts>`. It ensures that ``1`` has type
153+
``OneTwoThree`` instead of just ``int``. Therefore, it has access to the member predicate
154+
``getAString()``.
151155

152156
Member predicates are especially useful because you can chain them together. For example, you
153157
can use ``toUpperCase()``, a built-in function defined for ``string``::

0 commit comments

Comments
 (0)