ITPEC FE Morning April 2019 Question 46

In the UML class diagram, which of the following represents the relationship between the classes as shown in the figure below?

Class1Class2

Explanation

Generalization — a solid line ending in a hollow triangle that points at the superclass.

In the figure the line leaves Class2 and ends in a hollow triangle at Class1. That is the UML notation for generalization: Class2 is a subclass of Class1 and inherits its attributes and operations ("Class2 is a Class1"). The triangle always points at the more general class.

RelationshipNotation
Generalizationsolid line, hollow triangle at the superclass
Aggregationsolid line, hollow diamond at the whole
Compositionsolid line, filled diamond at the whole
Associationplain solid line, optionally an open arrowhead

Answer (d)

Why not others:

  • •(a) Aggregation — a whole-part relation drawn with a hollow diamond, not a triangle
  • •(b) Association — a plain line (or open arrowhead for navigability), with no triangle
  • •(c) Composition — a strong whole-part relation drawn with a filled diamond

Key rule: Triangle means "is a" (generalization); diamond means "has a" (hollow for aggregation, filled for composition), always drawn at the whole.

System Development Technology · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.