Omar
Omar

Reputation: 1091

How are these 2 classes related?

If you have an Arrival class and a Flight class where the Arrival class has all the information pertaining a Flight (the flight ID, eta, runway #, gate) coming in...would it be an association?

I'm a little confused as to what it could be since the Arrival class doesn't really have a purpose unless there is a flight so an arrival is related to the flight.

I can see it being both: Arrival has a Flight (aggregation?) Arrival uses/needs a Flight (dependence?)

Any guidance would be appreciated

Upvotes: 0

Views: 38

Answers (2)

Gerd Wagner
Gerd Wagner

Reputation: 5673

For understanding your issue, one should not think in terms of UML, but rather take a look at how things are/work in the real world.

A particular flight, in the real world, is an activity that is composed of a departure event and an arrival event.

Consequently, if you capture flight types in the form of a class Flight, then a class Arrival is associated with Flight using a one-to-one composition (association) expressing the fact that a flight has an arrival as a component.

Upvotes: 0

Cristian Mocanu
Cristian Mocanu

Reputation: 75

I don't know what Flight class attributes are, but it looks like a composition relationship. The Flight has an Arrival and the Arrival can not exist without a Flight.

Upvotes: 1

Related Questions