Hi !
Could some help with some tutorial about Object Associations: Aggregation and Containment. in C#
I tried hard to figure out what does it mean but still I didn' t get the idea more cleare ,
Br
Henry
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pravin MorePosted Dec 5, 2011, 8:17 AM
Hi Henry,
1.Containment describes the idea of one class having a data member that is an object of another type.i.e You can create a class which can use a object of another class.
for e.g:-Delegation expresses the idea that one class uses another class to accomplish a task or goal. Delegation is usually accomplished by containment.
2.Aggregation is a specialize form of Association where all object have their own lifecycle but there is ownership and child object can not belongs to another parent object. Let's take an example of Department and teacher. A single teacher can not belongs to multiple departments, but if we delete the department teacher object will not destroy. We can think about "has-a" relationship.
Thanks,
Pravin.