|
Association Definition
[Previous]  [Next] 
|
![]() |
User Manual [Previous]  [Next] Association DefinitionAn association defines a relationship from a class to another class. More specifically, it defines which links (i.e. references or pointers) may exist at run time between instances of the classes. Umple supports binary associations (associations with just two ends). This definition includes reflexive associations, in which both ends are the same class. An association can specify the following information:
The following is a UML diagram showing associations. The corresponding Umple is at the end of the page.
Associations can be presented in two ways in Umple.
There are several special kinds of associations in Umple.
Umple will report an error if an association refers to a non-existent class. Example
// Example code illustrating various
// kinds of associations
class A {}
// Class with inline association having role name
class B {
1 -- * A endTwo;
}
// Class with reflexive association
class C {
0..1 -- * C;
1 -- 0..1 D; // D is external
}
// Independently defined and directed association
association {
0..1 A -> * C;
}
// Class with composition
class E {
0..1 <@>- * A;
}
// Reference to a class defined elsewhere
external D {}
Load the above code into UmpleOnline |