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

thanks
Manoj

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

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

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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.