by, 04-26-2012 at 07:13 PM (567 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.