This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi, havent been on this site for a while. Could someone please explain aggregation to me. I don't understand it!!!???!! Ive been looing through all my books and still has not sunk in. Whats a basic definition for it and what could be a good example for it.
well, i don't know if this pertains to this forum(as it seems general question to me applicable to C++/C# any object oriented thing) but i'd try to provide u the answer... aggregation as per the online Merriam Dictionary, 1 : a group, body, or mass composed of many distinct parts or individuals 2 a : the collecting of units or parts into a mass or whole b : the condition of being so collected i would say aggregation means "is consist of" term that specifies that "something is consist of something because else the first something doesn't exist " (sorry for little confusing statement. it would sound like recursion) e.g. 1. CAR is an aggregation of engine, tires,seats etc... (engine is consist of these things. it can't be there w/o those things. can u think of a car w/o engine??) engine can be again defined as aggregation of brakes, battery, timing belt u know etc... 2. world is an aggregation of people in it (world consist of people. if there is no person on earth then its probably just a planet and no one would be refering it to as 'world', right?)
3. JAR file is an aggregation of classes and other possible resources 4. computer is an aggregation of, CPU, monitor,key board, mouse etc what i 've observed in most cases is- the top object, which is the aggregation of set of certain other thing, is 'logical' not 'physical'. CAR i would say is just a word. it becomes a real object when we have put together engine, seats,stearing etc...by definition of a CAR we just percieve that it has to have certain properties like tires, engine etc hope this helps u. regards maulin
How about this... Inheritance uses IS-A relationships, for instance: Dog IS-A Canine and Canine IS-A Animal Aggregation uses HAS-A relationships, for instance: Dog HAS-A collar Car HAS-A Engine. In Java, aggregation means one class that has, as some of its instance variables, instances of other classes, for example: class Dog { Collar c = new Collar( ); } This is aggregation, Dog HAS-A Collar.
Eliminate fossil fuel subsidies. (If you're not on the edge, you're taking up too much room.)
Bert Bates
author
Sheriff
Joined: Oct 14, 2002
Posts: 8717
posted
0
As a pre-emptive measure, the question asked for a 'basic' explanation and example - sticklers might say this is an over-simplification but I'm sticking to my 'this is a good basic 'answer / example' ' guns.
As a pre-emptive measure, the question asked for a 'basic' explanation and example - sticklers might say this is an over-simplification but I'm sticking to my 'this is a good basic 'answer / example' ' guns.