Can someone please explain me what is type of aggregation is and why for that the vector should not be initialized and this code is according to diagram? What I don't understand why when is -> at the end of aggregation or composition the vector shouldn't be internalized.
class Project
{
private Vector<Student> stds;
private Vector<Diag> diagra = new Vector();
}
This code does not allow to make a difference between association, aggregation, composition. The initialization or not of the vector is not relevant.
The UML says that a Project
has an unspecified number of Student
. Since it is aggregation, there is no exclusive ownership, sot the same students can appear in several projects. ALsi, when the project is destroyed, all its students remain unaffected.
stds
unitialized. This says nor guarantees anything about ownership of the Student.stds
vector if the project is supposed to aggregate some students.The UML says the a Project
is a composite that has an unspecified number of Diag
. The composition means an exclusive ownership, not of the vector, but of the diagrams that are stored within: