Results 1 to 6 of 6

Thread: Differentiation between Inheritance and Aggregation

  1. #1
    Join Date
    Dec 2009
    Posts
    32

    Differentiation between Inheritance and Aggregation

    Hi All,

    I have too many confusion about the various java concepts. I have some knowledge about the Inheritance. But the thing is that I don't know anything about the difference between Inheritance and Aggregation. I know inheritance is used for to implement the re-usability of program code. But but not able to get the differentiation between Inheritance and Aggregation. I wonder if you are able to help me to understand this.

  2. #2
    Join Date
    Feb 2008
    Posts
    1,856

    Re: Differentiation between Inheritance and Aggregation

    The concept of inheritance is one of the most important concept of object oriented programming because it irreversibly determines the manner in which a code Java is written. Inheritance is a mechanism to create a new class from an existing class in him uttering his properties and methods. In this way, the inherited classes form a hierarchy descending on top of which is the base class.

  3. #3
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Differentiation between Inheritance and Aggregation

    It is sometimes difficult to choose between classical association and aggregation. An aggregation is a special relationship between an object and several objects the component. An aggregation is sometimes called aggregation of reference as opposed to aggregation by value (also called composition). An aggregation is represented by an empty diamond positioned on the side of the compound (the class representing the whole).

  4. #4
    Join Date
    Apr 2008
    Posts
    1,949

    Re: Differentiation between Inheritance and Aggregation

    A composition is an aggregation constraint. The additional constraint compared to a traditional aggregation is relative to the lifetime of objects. The composition implies that components are dependent existence of the compound. A composition is also called aggregation by value. A "implements" Java is represented by an inheritance relationship but with a dotted arrow. To define a new class, we only need to inherit the an existing class and add new methods.

  5. #5
    Join Date
    May 2008
    Posts
    2,015

    Re: Differentiation between Inheritance and Aggregation

    Following is example of Aggregation:
    class Ai (
    private Bi objBi;
    ...
    )
    //If Class Bi is used primarily in the context of Ai, you can also opt for an inner class:
    public class Ai
    (
    private Atti1;
    private class Bi
    (
    att_de_Bi_1 string;
    )
    )

  6. #6
    Join Date
    May 2008
    Posts
    2,302

    Re: Differentiation between Inheritance and Aggregation

    When instantiating a class, it inherits all properties and methods of its super-class, which itself inherits a possible super-class. By default a class inherits from the super-super-class "named Object. To inherit a class from a super-class, Java provides the keyword 'extends', The main job of the Java programmer is to design a class hierarchy, that is to say, organizing classes such as the properties and methods common to several classes are placed in a super-class.

Similar Threads

  1. Replies: 3
    Last Post: 08-01-2011, 05:32 AM
  2. Differentiation between Containment and Inheritance
    By Bottlenecked in forum Software Development
    Replies: 5
    Last Post: 21-01-2010, 08:59 AM
  3. Differentiation between WAN and LAN
    By Dolsy_bendal in forum Networking & Security
    Replies: 4
    Last Post: 30-11-2009, 09:46 AM
  4. SQL error of aggregation
    By Bull50 in forum Software Development
    Replies: 2
    Last Post: 09-05-2009, 11:37 AM
  5. Link Aggregation - Bundling of interfaces
    By Willi in forum Networking & Security
    Replies: 4
    Last Post: 10-04-2009, 03:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •