4
Contributors
5
Replies
7
Views
12 Years
Discussion Span
Last Post by Manojsah
0

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

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

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

0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.