Dynamic View Services > Specifying Dynamic View Types > References > Support of Inheritance When Resolving References
 
Support of Inheritance When Resolving References
When resolving references at runtime, Rogue Wave® Server takes into account inheritance relationships between classes, and resolves references according to the represent clauses that have been defined in the dynamic view specifications.
Example
We have the following classes:
*a class BaseA which owns a list of X,
*a class A which inherits from BaseA, and
*a class X which has an inverse relation on BaseA.
The following dynamic view specification has been defined on the corresponding objects:
subscribe BaseA:
represent Table table when (...):
propagare listOfX;
subscribe A:
represent SubTable table when (...):
subscribe X:
represent Row row:
Ref<Table> owner=myBaseA->table;
At runtime, any reference will be assigned according to the actual type of the target of the relation myBaseA. Two cases:
*If this object is a BaseA object, the clause subscribe BaseA will be executed and the reference will refer to the corresponding table.
*If this object is a A object, the clause subscribe A will be executed and the reference will refer to the corresponding table.
The dynamic resolution is possible only if the referenced representations have the same name (table in this example). In the clause subscribe A, the table representation object can be an instance of the Table type or of a subclass (SubTable in this example).

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.