---
title: "Four class relationships from figure"
subject: "Object Oriented Analysis and Design"
chapter: 2
key: "semester_6/object_oriented_analysis_and_design:class-relationships-from-figure"
source: https://www.bctengineer.com/q/semester_6/object_oriented_analysis_and_design/class-relationships-from-figure
site: BCT Engineering
---

# Four class relationships from figure

Object Oriented Analysis and Design · Chapter 2: Object Oriented Analysis

- Asked in: 2069 Bhadra, 8 marks
- Video: [UML Class and Object Diagrams | Association vs. Aggregation vs. Composition | Geekific](https://www.youtube.com/watch?v=sN2_CoB_kbw) — Geekific
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/object_oriented_analysis_and_design/class-relationships-from-figure
- Whole chapter: https://www.bctengineer.com/md/semester_6/object_oriented_analysis_and_design/chapter-2

## Question

Explain four different types of relationships that we model in object-oriented analysis, which exists between two different classes represented as shown in below figure. [Figure: two class boxes connected by relationship arrows; the figure is not legible in the scan.]

## Short answer

The four key relationships are dependency (dashed arrow for a uses-a relationship), association (solid line with multiplicity, including aggregation hollow diamond and composition filled diamond), generalization (hollow triangle for is-a inheritance), and realization (dashed hollow triangle for implementing an interface).

## Answer

The figure is not legible, so the four standard relationships that UML models between two classes are explained with their notation: **dependency, association, generalization and realization** (the four listed in the UML User Guide). Aggregation and composition are covered as special forms of association.

#### 1. Dependency
A weak, temporary "uses" relation: a change in the supplier may affect the client, e.g. when the supplier is a method parameter or local variable. Drawn as a dashed arrow towards the supplier.
```text
 +---------+  - - - - ->  +--------+
 | Printer |   <<use>>    | Report |
 +---------+              +--------+
```

#### 2. Association (with aggregation and composition)
A structural link between objects of two classes ("knows/is linked to"). Drawn as a solid line, with a name, role names and multiplicity.
```text
 +---------+ 1      0..* +---------+
 | Teacher |-------------| Student |
 +---------+  teaches    +---------+
```
A teacher teaches many students.

Aggregation is a "has-a" (whole-part) association where the part can exist without the whole (hollow diamond at the whole). Composition is a strong form where the part dies with the whole (filled diamond).
```text
 +-------+ <>-------- +--------+   hollow: aggregation
 | Team  |            | Player |
 +-------+ <#>------- +--------+   filled: composition
 | House |            | Room   |
```

#### 3. Generalization (inheritance)
An "is-a" relation between a general superclass and specialised subclasses. Drawn as a solid line with a hollow triangle at the superclass.
```text
        +--------+
        | Person |
        +--------+
            ^
      +-----+-----+
 +---------+ +---------+
 | Student | | Teacher |
 +---------+ +---------+
```

#### 4. Realization
A relation between an interface (a specification) and the class that implements it; the class promises to provide all the interface's operations. Drawn as a dashed line with a hollow triangle pointing to the interface.
```text
 +---------------+
 | <<interface>> |
 |   Printable   |
 +---------------+
         ^
         :  (dashed, hollow triangle)
 +---------------+
 |    Invoice    |
 +---------------+
```

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What is the difference between aggregation and composition?
   A. Aggregation: part can exist without the whole (hollow diamond); composition: part dies with the whole (filled diamond)
   B. Aggregation: filled diamond; composition: hollow
   C. Both mean 'is-a'
   D. Aggregation is dashed
   Answer: A. Team-Player is aggregation; House-Room is composition. (Key point: Aggregation vs composition)

2. How is generalization drawn in UML?
   A. Dashed arrow
   B. Solid line with a hollow triangle at the superclass
   C. Solid line with a filled diamond
   D. Plain line with multiplicity
   Answer: B. Generalization is the 'is-a' relationship, e.g. Student is a Person. (Key point: Generalization notation)

3. Which describes dependency?
   A. A strong whole-part link
   B. A weak, temporary 'uses' relation (e.g. a parameter), drawn as a dashed arrow to the supplier
   C. An 'is-a' relation
   D. A relation with multiplicity 1..*
   Answer: B. A change in the supplier may affect the client. (Key point: Dependency)

4. What is an association?
   A. A structural link between objects of two classes, drawn as a solid line with role names and multiplicity
   B. A dashed arrow
   C. An inheritance link
   D. A realisation of an interface
   Answer: A. E.g. a Teacher teaches many Students. (Key point: Association)

## Related in Object Oriented Analysis and Design

- [Object oriented system and core concepts](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aoo-system-concepts-explained) — Object Oriented Analysis and Design, chapter 1
- [Create classes from design class diagrams](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aclasses-from-design-class-diagram) — Object Oriented Analysis and Design, chapter 4, asked 2×
- [Identify conceptual classes; create domain model](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aconceptual-classes-domain-model-steps) — Object Oriented Analysis and Design, chapter 2
- [Algorithmic vs object-oriented decomposition](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aalgorithmic-vs-oo-decomposition) — Object Oriented Analysis and Design, chapter 1
- [XYZ Marina class diagram](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Amarina-class-diagram) — Object Oriented Analysis and Design, chapter 2
- [Video rental shop class diagram](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Avideo-rental-class-diagram) — Object Oriented Analysis and Design, chapter 2

## Related in other subjects

- [Compare procedural and object oriented programming](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Aprocedural-vs-oop-compare) — Object Oriented Programming, chapter 1
- [Vector class addition by object argument](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Avector-class-addition) — Object Oriented Programming, chapter 1
- [Add objects of two different classes](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Afriend-add-two-class-objects) — Object Oriented Programming, chapter 4, asked 2×
- [T/F: SSR not below 1.8](https://www.bctengineer.com/question.md?key=semester_8%2Ftransmission_and_distribution_system_design%3Atf-ssr-below-1-8) — Transmission and Distribution System Design, chapter 3, asked 3×
