by, 04-26-2012 at 06:13 PM (303 Views)
In object oriented design when progress is made, various objects will be encountered in problem domain which holds many other objects. In such cases, one will need to model a same kind of arrangement, in your solution’s design. In case of Java program’s object oriented design, the manner in which objects are modeled that have other objects, is with composition. Constituent object references become the containing object’s field, with composition.
For instance it is considered to be very useful when your program’s cup of coffee object may have coffee.Coffee might be itself a distinct class which can be instantiated by your program.Coffee will be awarded with a type in case that behavior is exhibited which is considered essential for your solution. When stirred, might be it will be swirled in one or other way. Temprature track shall be kept which may change over time or coffee proportion track shall be kept, or any other additives like sugar or cream.