Expressions and Type Inheritance
You can reference a parent class or a derived class in the data-member access path of an expression.
For example, let us assume the following Server model:
B inherits from A
C has a unary relation r on A
The following specification is correct:
subscribe origin B:
represent Table t:
...;
subscribe C:
represent Row row:
Ref<Table> table=r.B->table;
When expression r.B->t is evaluated, the following happens:
First the target of the relation
r is accessed. If it exists, it is safely downcast to the type
B (using the static member function
B::Narrow).
If the downcast succeeds, the reference of the table associated with the
B object, if any, is returned.
In other cases, a null reference is returned.
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.