In the below diagram, the class "Copy" and class "Book" are showing an aggregation (Book has a Copy). All other classes are sub classes of class "Copy". Now, imagine there is a Member
class, which has to access the sub classes "Lending" and "Borrow" of class "Copy". The only thing that 'Member
' class should know is "accessionNumber".
If we think of this in terms of code, my "Book
" class contains an array of "Copy
".
How can I know the accessionNumber of a particular book?
Lets say I need the "accessionNumber" of the 3rd book in my copies
array. But the array is in the Book
class, and there is no connection to the Book
class from the Copy
class.
If we create a connection back, would that be like "Copy has a Book", or more meaningfully, something like "Subject has Student" (taking the famous aggregation example "Student has a Subject)?