From the course: Programming Foundations: Object-Oriented Design
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Aggregation - Python Tutorial
From the course: Programming Foundations: Object-Oriented Design
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…
Contents
-
-
-
-
-
-
-
-
(Locked)
Identifying inheritance situations4m 55s
-
(Locked)
Using inheritance2m 44s
-
(Locked)
Abstract and concrete classes3m 10s
-
(Locked)
Interfaces4m 15s
-
(Locked)
Aggregation2m 3s
-
(Locked)
Composition1m 45s
-
(Locked)
Challenge: Jukebox class relationships1m 6s
-
(Locked)
Solution: Jukebox class relationships3m 17s
-
(Locked)
-
-