Answer the question
In order to leave comments, you need to log in
What is the difference between association, aggregation and composition at the code level?
Hello.
Bayan is rare, but there still seems to be no clear answer to it.
class Aggregation
{
protected $obj;
public function __construct(Model $Model)
{
// Не является ли это ассоциацией?
$this->obj = $Model;
}
}
class Composition
{
protected $obj;
public function __construct()
{
// Не является ли это ассоциацией?
$this->obj = new Model();
}
}
Answer the question
In order to leave comments, you need to log in
softwareengineering.stackexchange.com/questions/23...
stackoverflow.com/questions/13044984/difference-be...
Wiki: "Association shows that objects of one entity (class) are related to objects of another entity in such a way that one can navigate from objects of one class to another is a general case of composition and aggregation."
Class diagram
There are many unnecessary articles for aggregation and composition, although everything is very clear there, in the case of association there is no clear definition.
UPD: java-course.ru/begin/relations
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question