[Uml-devel] todo question

Andrew Sutton ansutton at kent.edu
Tue Oct 15 04:37:11 UTC 2002


i read this on the todo list:

Just what are the UML rules on associations? Can I have multiple associations 
between the same two classes? How does it differ for composition/aggregation 
and for implementation/realisation?

yes. you can have multiple associations between the same two classes. you can, 
in fact, have multiple associations on the same class to itself. here's how 
to convince yourself:

take a DOM Element. each DOM Element has a list of child Nodes and a list of 
sibling Nodes. That's two relationships to another class (both of type Node). 
at least, i think those relationships exist on Element and not on Node.

composition and aggregation are special types of association so the rules are 
the same. in fact, in this brief example, both are of type aggregation.

implementation is pretty easy:

class Element : public Node
{
	std::list<Node *> siblings;
	std::list<Node *> children;
};

-- 
Andrew Sutton
ansutton at kent.edu




More information about the umbrello-devel mailing list