Summary

 < Day Day Up > 



Class behavior can be implemented by building upon the behavior of other classes. A class built from other user- defined classes is called an aggregate class or aggregation. There are two forms of aggregation: simple and composite. In simple aggregation the whole object does not control the lifetime of its part objects. This means that part objects could play a role in more than one aggregate relationship. In composite aggregation the whole object controls the lifetime of its part objects. This means it controls their creation and destruction. Composite aggregates can be formed from simple part objects, part objects allocated dynamically, or from a combination of both. Composite aggregates control the lifetimes of their part objects; simple aggregates do not.

The UML class diagram can be used to illustrate aggregate relationships. A line between classes denotes an association. A diamond is placed at one end of the association line denoting aggregation. A hollow diamond indicates simple aggregation; a solid diamond indicates composite aggregation.

The UML sequence diagram is used to illustrate message passing between objects. Whereas the class diagram shows the static relationship between classes in an object-oriented application, a sequence diagram shows the dynamic interaction between objects in the application.



 < Day Day Up > 



C++ for Artists. The Art, Philosophy, and Science of Object-Oriented Programming
C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504028
EAN: 2147483647
Year: 2003
Pages: 340
Authors: Rick Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net