December 2016
Intermediate to advanced
841 pages
17h
English
In OOP, classes can have some kind of relationship with each other. Now, we will take a look at the three different types of relationships between classes.
We call association those relationships whose objects have an independent lifecycle and where there is no ownership between the objects. Let's take an example of a teacher and student. Multiple students can associate with a single teacher, and a single student can associate with multiple teachers, but both have their own lifecycles (both can be create and delete independently); so when a teacher leaves the school, we don't need to delete any students, and when a student leaves the school, we don't need to delete any teachers.
We ...
Read now
Unlock full access