permaculture playing cards*
The moose likes Beginning Java and the fly likes Aggregation and Compostion!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Aggregation and Compostion!!" Watch "Aggregation and Compostion!!" New topic
Author

Aggregation and Compostion!!

Ravi Kumar Ravuru
Ranch Hand

Joined: Apr 18, 2002
Posts: 176
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

Joined: Nov 04, 2001
Posts: 1871
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

Joined: Dec 10, 2001
Posts: 7023
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.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Aggregation and Compostion!!