Java Reference
In-Depth Information
Relationships
In the next few sections, I will examine the important relationships that exist between the
classes in a software system.
Generalization
The generalization relation indicates inheritance between two or more classes. This is a
parent-child relationship, in which the child inherits some or all of the attributes and
behavior of the parent. It is also possible for the child to override some of the behaviors
and attributes. Figure 1-10 shows the generalization relationship.
Figure 1-10. Generalization
Association
Association shows a general relation between two classes. In an actual class, this is shown
with one class holding an instance of the other. An insurance policy always has one or
more parties involved, with the most prominent being the policyholder who owns this
policy. There can be an agent who helps and guides the policyholder to take this policy.
Association often shows named roles, cardinality, and constraints to describe the relation
in detail, as shown in Figure 1-11.
Figure 1-11. Association
 
Search WWH ::




Custom Search