homepage › Forums › BridgePoint/xtUML Usage and Training › Implementing Inheritance in Model
Tagged: inheritance, subtype, supertype
- This topic has 3 replies, 2 voices, and was last updated 3 years, 7 months ago by
cort.
- AuthorPosts
- September 2, 2017 at 6:58 pm #5915
Rob
ParticipantDo you have examples how to setup inheritance in the model? I set up a basic scenario in which I setup an inheritance relationship between the super class and derived class. I had an attribute in the derive class. I instantiated the classes in OAL but i could not access the “inherited attribute” in the derived class. Any insight on setting up inheritance where i can inherit attributes?
Thanks,
RobSeptember 2, 2017 at 8:23 pm #5916cort
KeymasterIn xtUML, traditional inheritance is not completely present. Here are some specifics.
– On state machines, event inheritance _polymorphic events_ are supported. Events to a supertype can be received at the subtype.
– In the MASL dialect of xtUML, operation inheritance (_deferred operation_) is supported.
– Attributes are instantiated in the instance of the class in which they are defined. In xtUML, the hierarchy of classes is instantiated as a _related instance chain_. Access to attributes in a supertype is via navigation.Here is an example model showing a sub/super hierarchy: https://github.com/xtuml/models/tree/master/VandMC_testing/mctest/subsuperchain
Here is a video on the various association types. Just after 1:30 a sub/super is diagrammed.
September 2, 2017 at 9:10 pm #5917Rob
ParticipantFor the 3rd case is the “_related instance chain_” the name of the associated link to navigate? Is “_related instance chain_” defined “automatically” when the super-type relation is “drawn”?
Thanks,
RobSeptember 2, 2017 at 9:28 pm #5918cort
KeymasterWhen you create the instances of the sub/supertype hierarchy (in OAL using create). You will also relate them (using the relate statement).
So, then when you access these instances, you can navigate across the association using the relationship number of that association (using the OAL select … related by statement).
The example model should demonstrate this. Let me know if you want pointers to other example models.
- AuthorPosts
- You must be logged in to reply to this topic.