File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Aggregation and Compostion!!

 
Ravi Kumar Ravuru
Ranch Hand
Posts: 176
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Folks,
If there are two classes Car and Wheel,how to represent Aggregation and Compostion?I need to the classes skeleton to represent the same?Please help me out.
Regards,
Ravi
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravi
To me Aggregation and Composition have same meaning. So, you need only one of them.
Car has wheels. ie. Wheels are one part of a car hence Car object will have a reference to Wheel object (may be array of four)...
Now, aggregation could be applied as Car does have more than just wheels. It has glasses, windsheild, machine, body etc...So Car is an aggregation of all of those...
Regards
Maulin
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you considered, Ravi?
You might want to try a quick search for this topic on this forum, the intermediate forum, and the OO forum. It's been discussed quite a few times before, and you might be able to gather some good information from those previous conversations.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic