mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
QL HB: Explain use of cast [SD-3865]
(cherry picked from commit f5de1dc999)
This commit is contained in:
@@ -147,7 +147,11 @@ predicate from the :ref:`above <defining-class>` class::
|
||||
|
||||
1.(OneTwoThree).getAString()
|
||||
|
||||
This call returns the results ``"One, two or three: 1"``.
|
||||
This call returns the result ``"One, two or three: 1"``.
|
||||
|
||||
The expression ``(OneTwoThree)`` is a :ref:`cast <casts>`. It ensures that ``1`` has type
|
||||
``OneTwoThree`` instead of just ``int``. Therefore, it has access to the member predicate
|
||||
``getAString()``.
|
||||
|
||||
Member predicates are especially useful because you can chain them together. For example, you
|
||||
can use ``toUpperCase()``, a built-in function defined for ``string``::
|
||||
|
||||
Reference in New Issue
Block a user