I have two classes.
Employee (Model)
EmployeeInfo (Another Class)
//Employee GetEmployeeInfo(int empCode) (MethodName)
EmployeeInfo
class returns a Employee
type.
Now, what is the relationship
between Employee
and EmployeeInfo
?
(Aggregation, Composition or Association ?)
My guess is that, a new instance of Employee
is created within the EmployeeInfo
. So, when EmployeeInfo
class object dies, so does Employee
. This signifies a death relationship
. So, the relationship is Composition
?
Sorry if this is a naive question, but cant get it right.
If a particular EmployeeInfo is created with and dies with a specific Employee then it's Composition.
If a particular EmployeeInfo can have a specific Employee, but can exist without it then it's Aggregation.
Both Composition and Aggregation are types of Associations, they are just specialized associations.
Yes I would say the relationship you are describing would be composition.