From the course: Programming Foundations: Object-Oriented Design

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Aggregation

Aggregation - Python Tutorial

From the course: Programming Foundations: Object-Oriented Design

Start my 1-month free trial

Aggregation

- Inheritance is just one type of relationship that can exist between objects. The concept of aggregation is another type of object relationship in which one object is built of other objects. - Like this fleet of spaceships. We can think of a fleet as an object that contains a bunch of individual spaceship objects. - [Male Instructor] Aggregation is often referred to as a has a relationship, as opposed to the is a relationship of inheritance. I wouldn't say that the fleet is a spaceship, but I could say that the fleet has a spaceship. - Only one ship? Well, that's a puny little fleet. - Well, in this context, has a can implicitly suggest has many. So a fleet has many spaceships. - That's more like it. - What we're exploring here is that a has a relationship is different from the is a relationship of inheritance. In UML diagrams, we can represent the has a relationship for aggregation with an unfilled diamond. So the diagram here represents a fleet object that contains a collection of…

Contents