Skip to content

Latest commit

 

History

History
54 lines (28 loc) · 1.29 KB

README.md

File metadata and controls

54 lines (28 loc) · 1.29 KB

Class relationships

Aggregation

Code example here

A library and a book can exists without each other, but usually a library contains books.

Aggregation

Composition

Code example here.

A house is composed of several rooms. Without rooms a house cannot exist.

Composition

Dependency

Code example here.

The racecar is dependent on a driver in order to drive the car, but can exist without a driver. There can also be different drivers driving the car.

Dependency

Inheritance

Code example here.

A racecar is a car and has the same functionality like steering, braking and so on. The racecar can have additional functionality like using turbo or other things which are not found in a standard car.

Inheritance

Interface/implementation

Code example here.

Interface like a blueprint. In this case we have a vehicle, which should be able to go forward, reverse, steer, brake, etc. There exists different kinds of vehicles like cars or boats, which have differnt methods of moving and steering.

The bluprint(abstract class) only defines the standard behavior every vehicle must have.

Interface