Dear Friends,
I have following details regarding the relationship between various classes.
1. Association
An Association is a generic relationship between two classes, and is modeled by a line connecting the two classes. This line can be qualified with the type of relationship, and can also feature multiplicity rules (eg. one-to-one, one-to-many, many-to-many) for the relationship.
2. Composition
If a class cannot exist by itself, and instead must be a member of another class, then that class has a Composition relationship with the containing class. A Composition relationship is indicated by a line with a filled diamond.
3. Dependency
When a class uses another class, perhaps as a member variable or a parameter, and so "depends" on that class, a Dependency relationship is formed. A Dependency relationship is indicated by a dotted arrow.
4. Aggregation
Aggregations indicate a whole-part relationship, and are known as "has-a" relationships.
An Aggregation relationship is indicated by a line with a hollow diamond.
5. Generalization
A Generalization relationship is the equivalent of an inheritance relationship in object-oriented terms (an "is-a" relationship). A Generalization relationship is indicated by an arrow with a hollow arrowhead pointing to the base, or "parent", class.
Still except Generalization (here child class extends from the base class) I am not able to visualize the above concepts with respect to a
Java code example. Can anyone please provide some light on these?
Thanks in advance
Regards
Johnson :roll:
Association [edited the subject to be more expressive - Ilja]
[ October 10, 2003: Message edited by: Ilja Preuss ]