Geert,
thanks for the quick reply. So considering the two constraints you mentioned, the conclusion for my examples would be:
class B certainly does not not use composition (both constraints are violated), but I assumed Association originally, which still seems correct.
class C uses composition, since the private member is not shared, and it is destroyed when B is destroyed.
classes D and E could be seen as composition as well, provided the instance of A is not shared.
If C, D or E, respectively, would share the instance of A, it would be Aggregation.
And if they would not destroy the instance of A upon their own destruction, it would be Association.
Is this basically correct?
To put it more generic:
Association: "uses" without exclusive access and without control of the lifetime.
Aggregation: "owns" without exclusive access but with control of the lifetime.
Composition: "exclusively owns" with exclusive access and with control of the lifetime.
Maybe this is somewhat oversimplified, but could you agree?
If yes, I dare say that EA could detect the different shades of association, aggregation and composition when reverse engineering. Maybe it is not easily possible to detect it always, but then association would still be a valid fall-back (as it is in all cases today).
Hmmm... thinking about it... this would mean EA has to parse functional code, searching for instantiations and deletions, having an eye on all the pointers that are passed around etc. If this kind of analysis is no already part of the software then it might be a big mountain to climb...
Regards,
Matthias