|
|
|
Re: [Xcore] Using the same field name in subclasses [message #1081028 is a reply to message #1081014] |
Tue, 06 August 2013 17:56 |
Ed Merks Messages: 33139 Registered: July 2009 |
Senior Member |
|
|
Hugo,
Yes, the additional opposite feature you want to define in EventPort
must have a different name than "parent" which is used up by the super type.
On 06/08/2013 7:35 PM, Hugo A. Garcia wrote:
> Comments at the bottom.
>
> On 2013-08-06 19:19, Ed Merks wrote:
>> Hugo,
>>
>> Comments below.
>>
>> On 06/08/2013 6:51 PM, Hugo A. Garcia wrote:
>>> Hi
>>>
>>> I have:
>>>
>>> class TaskContext {
>>> ...
>>> refers InputPort [] inputPorts opposite parent
>>> refers EventPort[] eventPorts opposite eventParent
>>> refers OutputPort [] outputPorts opposite parent
>>> ...
>>> }
>>>
>>> where:
>>>
>>> class InputPort
>>> {
>>> String [1] name
>>> refers DataType dataType
>>> refers TaskContext parent opposite inputPorts
>>> }
>>>
>>> class EventPort extends InputPort {
>>> refers TaskContext eventParent opposite eventPorts
>>> }
>>>
>>> class OutputPort
>>> {
>>> String [1] name
>>> refers DataType dataType
>>> refers TaskContext parent opposite outputPorts
>>> }
>>>
>>> so...
>>>
>>> I would like to have
>>>
>>> class TaskContext {
>>> ...
>>> refers EventPort[] eventPorts opposite parent
>>> ...
>>> }
>>>
>>>
>>> class EventPort extends InputPort {
>>> refers TaskContext parent opposite eventPorts
>>> }
>>>
>>> BUT the editor complains that I cannot 'There may not be two features
>>> named parent'
>> No, you can't have that. An EventPort could be referenced by two
>> different TaskContexts, one via inputPorts and the other via
>> eventPorts. Opposites must be paired, and feature names must be
>> unique...
>>>
>>> -H
>>
>
> ok... so I go a make a bidirectional refers in EventPort so that it
> can use 'parent' from its super type InputPort?
>
> -H
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04064 seconds