
I can see many UML example like above diagram. I can understand that
I can implement case 1 like below.
class A {
public:
B b[10];
};
But how can I implement case 2? No navigability but has multiplicity? I am totally confused of case 2. What am I missing?
Yes, it is possible to have a multiplicity without navigability.
Navigability only makes a promise about the ease at runtime to find instances at the other end. The fact the there is no promise on navigability (or even an explicit absence of navigability with a X at the opposite end) does not change the existence of an association and hence the multiplicity.
The implementation of 2) could for example be done with a vector of pointers to A in B to navigate back (the navigability would exist, but is simply not indicated). Another implementation coukd be to use in A a vector of pointers to B, so that B can be shared, and some other mechanism make sure it is shared by 3 to 7 A's (no navigability, but multiplicity enforced)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With