Employee and EmployeeInfo - C # relationship
I have two classes.
Employee (Model)
EmployeeInfo (Another Class)
//Employee GetEmployeeInfo(int empCode) (MethodName)
EmployeeInfo
the class returns the type Employee
.
Now what is relationship
between Employee
and EmployeeInfo
? (Aggregation, composition or association?)
I am assuming that EmployeeInfo
a new instance is being created Employee
. So when the class object EmployeeInfo
is dying, then Employee
. This means death relationship
. So, attitude Composition
?
Sorry if this is a naive question, but it won't work.
If a specific EmployeeInfo is created and dies with a specific employee then it is a composition.
If a specific EmployeeInfo can have a specific Employee, but can exist without it, then it is Aggregation.
Both composition and aggregation are types of associations, they are only specialized associations.
Yes, I would say that the relationship that you describe will make up.
It can be either composition if EmployeeInfo owns (creates / disposes) Employee or Association (if Employee can exist outside EmployeeInfo).
Therefore, to answer your question, more information is required on how you use them (source code).
Strange, are these two classes designed by you? If not, it is difficult to know the relationship between the two.