@@ -387,26 +387,26 @@ from ``OneTwoThree`` and ``int``.
387387Non-extending subtypes
388388======================
389389
390- Besides extending base types, classes can also declare `instanceof ` relationships with other types.
391- Declaring a class as `instanceof Foo ` is roughly equivalent to saying `this instanceof Foo ` in the characteristic predicate.
392- The main differences are that you can call methods on Bar via `super ` and you can get better optimisation.
390+ Besides extending base types, classes can also declare `` instanceof ` ` relationships with other types.
391+ Declaring a class as `` instanceof Foo `` is roughly equivalent to saying `` this instanceof Foo ` ` in the characteristic predicate.
392+ The main differences are that you can call methods on `` Bar `` via `` super ` ` and you can get better optimisation.
393393
394394.. code-block :: ql
395395
396396 class Foo extends int {
397397 Foo() { this in [1 .. 10] }
398398
399- string foo_method () { result = "foo" }
399+ string fooMethod () { result = "foo" }
400400 }
401401
402402 class Bar instanceof Foo {
403- string toString() { result = super.foo_method () }
403+ string toString() { result = super.fooMethod () }
404404 }
405405
406- In this example, the characteristic predicate from `Foo ` also applies to `Bar `.
407- However, `foo_method ` is not exposed in `Bar `, so the query `select any(Bar b).foo_method() `
406+ In this example, the characteristic predicate from `` Foo `` also applies to `` Bar ` `.
407+ However, `` fooMethod `` is not exposed in `` Bar `` , so the query `` select any(Bar b).fooMethod() ` `
408408results in a compile time error. Note from the example that it is still possible to access
409- methods from instanceof supertypes from within the specialising class with the `super ` keyword.
409+ methods from instanceof supertypes from within the specialising class with the `` super ` ` keyword.
410410
411411Crucially, the instanceof **supertypes ** are not **base types **.
412412This means that these supertypes do not participate in overriding, and any fields of such
@@ -430,10 +430,10 @@ The following example demonstrates this.
430430 override string foo() { result = "bar" }
431431 }
432432
433- Here, the method `Bar::foo ` does not override `Foo::foo `.
434- Instead, it overrides only `Interface::foo `.
435- This means that `select any(Foo f).foo() ` yields only ` foo `.
436- Had `Bar ` been defined as `extends Foo `, then `select any(Foo b) ` would yield `bar `.
433+ Here, the method `` Bar::foo `` does not override `` Foo::foo ` `.
434+ Instead, it overrides only `` Interface::foo ` `.
435+ This means that `` select any(Foo f).foo() `` yields `` foo ` `.
436+ Had `` Bar `` been defined as `` extends Foo `` , then `` select any(Foo f).foo() `` would yield `` bar ` `.
437437
438438.. _character-types :
439439.. _domain-types :
0 commit comments