Troubleshooting
Problem
UML class diagrams allow the cardinality of associations to be constrained but unspecified at design time. While it is simple So what what needs to be done to dynamically NewClass1 is in a composite relationship with another class, NewClass2. The multiplicity for NewClass2 is zero or more, i.e. 0..*. How does one implement the composition with a 0..* multiplicity in Rose RealTime?
Resolving The Problem
Multiplicities define the number of objects that participate in an association relationship. There are two multiplicity indicators for each association, one at each end. .
The association end multiplicity specifies the number of instances of the component (part) end that will appear in the aggregate (whole) class.
To implement a class with a 0..* composition:
Create a constructor that takes an argument that specifies the number of objects that should be created. The constructor would then be responsible for instantiating the objects of the attributes class and be responsible for setting the value of the pointer to the address of the first object. In this way, you would be able to control at run time the number of objects that are created for the composition.
Please refer to the attached model which demonstrates this.
It is important to also change the destructors for the class to delete the objects created by the constructor, and also override the default constructor that does not take an argument, so that the value of the pointer does not point to uninitialized data.
Related Information
Historical Number
25825
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21127940