• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Aggregation

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...
I wanna know what I have to know about aggregation for 1.4 SCJP Tkz!
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you be more precise in your question, please?
Aggregation is usually known as a has_a relationship.
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Aggregation is a relationship between whole and part. But what exactly will be asked on this topic in exam?
Pls. Reply
Thanks
Salima
 
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there:
You can implement inheritance in two ways:
a. by extending a super class. for example:
class LivingBeing { }
class Man extends LivingBeing { }
class Woman extends LivingBeing { }
This is sort of "is a" relationship.
b. by aggregating other classes. for example:
class HumanBeing {
Man M = new Man();
Woman W = new Woman();
}
This is sort of "has a" relationships.
The questions on aggregating revolves around how do you access the methods and fields belonging to
Man and Woman classes from the objects of HumanBeing class.
Hope this helps.
Barkat
[ August 29, 2002: Message edited by: Barkat Mardhani ]
 
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the exam SCJP1.2 you can be asked to "model" a given example about concepts. Something like a "computer" class and several "O.S." classes.
You are given answers to choose between implementations using inheritance or composition.
--------------------
Barkat,
agregation is used to implement inheritance?
Maybe you mean that agregation can be used to get some of the benefits of inheritance: to add funtionality to a class.
 
Barkat Mardhani
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jose:
Original posted by Jose:

Barkat,
agregation is used to implement inheritance?
Maybe you mean that agregation can be used to get some of the benefits of inheritance: to add funtionality to a class.


It is very difficult to get to the exact intendended meaning of the authur when they use words like "aggregation" as different people mean
different things.
I think there are two sheds of meaning for aggregation:
1. within the context of a class, otherwise known
as composition, which is what I was trying to get
at in my first post. Here is a quote from Bruce Eckel's Thinking in Java


The simplest way to reuse a class is to just use an object of that class directly, but you can also place an object of that class inside a new class. We call this “creating a member object.” Your new class can be made up of any number and type of other objects, in any combination that you need to achieve the functionality desired in your new class. Because you are composing a new class from existing classes, this concept is called composition (or more generally, aggregation). Composition is often referred to as a “has-a” relationship, as in “a car has an engine.”


2. within the context of objects i.e. containers holding objects could be termed as aggretion.
Therefore, to answer the question originally posted in this thread: aggregation questions in exam could be related to composition and containers.
Thanks
Barkat
 
reply
    Bookmark Topic Watch Topic
  • New Topic