954,554 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Composition

Hi
I am having problems in getting Composition ?
pls tell about it.

thanks
Manoj

Manojsah
Newbie Poster
13 posts since Aug 2005
Reputation Points: 10
Solved Threads: 2
 

Composition is the act of taking two smaller items and putting them together to make a larger item.

Like a door handle being added to a door frame makes a door.

Regards,

Nate

hooknc
Posting Whiz in Training
219 posts since Aug 2005
Reputation Points: 11
Solved Threads: 8
 

Composition (called “has-a) is a relationship between classes where one class has a data member that is an instance of the other class, such as “a car has a tire. When creating a program, you need to choose whether to relate classes through inheritance or composition.


king

kingmahesh
Newbie Poster
4 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

Composition (called “has-a) is a relationship between classes where one class has a data member that is an instance of the other class, such as “a car has a tire. When creating a program, you need to choose whether to relate classes through inheritance or composition.

king

hi all,

with regard to composition and inheritance, there is a term named as polymorphism...is it related to the above? so infact, composition is inheritance, but in my class, we usually called the method as inheritance and the sub-classes have the attributes and properties of the main class. i mean from the main-class, u will have the sub-classes and the relationship is called inheritance. hope that what i understand can be of use to you. cheers! :D

tristan17
Junior Poster in Training
51 posts since Sep 2005
Reputation Points: 10
Solved Threads: 1
 

hi all,

with regard to composition and inheritance, there is a term named as polymorphism...is it related to the above? so infact, composition is inheritance, but in my class, we usually called the method as inheritance and the sub-classes have the attributes and properties of the main class. i mean from the main-class, u will have the sub-classes and the relationship is called inheritance. hope that what i understand can be of use to you. cheers! :D

Polymorphic behavior is more of a "is-a" relationship then a "has-a" relationship. A Circle is a type of Shape and should be able to be viewed as a Shape and have all the same behavior (methods) as Shape. Polymorphism is accomplished by both inheritance and interfaces in java.

Regards,

Nate

hooknc
Posting Whiz in Training
219 posts since Aug 2005
Reputation Points: 11
Solved Threads: 8
 

Hello To all who had make me to understand the basic Funda of Composition.

Can any of u please tell me where to use RECURSSION IN PROGRAM.
or WHEN THE PROGRAM DEMANDS IT. :?:


regards

Manojsah

Manojsah
Newbie Poster
13 posts since Aug 2005
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You