This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do we implement Composition and Aggregation relation in code ??

 
Abhineet Kapil
Ranch Hand
Posts: 52
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,,

I know both , compo and aggre are types of associations between classes. I know that composition is a strong relation .. aggre is a weak one..
eg. There is College, Departments, and Professors..
College class has a strong relation with Departments as the departments dont have individual existence..
But it has weak relation with Professors... Even after college is destroyed Professors may exist..

Please explain using a coding example how do we implement Composition and ho w do we implement aggregation ?
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic