4.11 Containment by Value Versus Containment by Reference

 <  Free Open Study  >  

The last topic related to containment is a language-dependent distinction between containment by value and containment by reference. Containment by value implies that an object contains another object; containment by reference implies that an object contains a pointer to another object. Containment by value requires that an object lives and dies together with another object. Containment by reference allows for optional pieces of objects (a shrimp cocktail may or may not contain cocktail sauce), the sharing of one object by a group of other objects (i.e., object sharing), containment of an abstract class (e.g., meal contains appetizer), and the weak form of containment discussed above. Languages that do not distinguish between these two flavors of containment support containment by reference only. While this issue typically does not affect designers since they do not care about the particular implementation of a containment relationship, I mention it here since many case tools that are commercially available have icons that demonstrate the distinction. These case tools are more interested in the distinction because they need to generate C++ code than for any real architectural purpose (C++ allows for the explicit distinction between containment by value and containment by reference).

 <  Free Open Study  >  


Object-Oriented Design Heuristics
Object-Oriented Design Heuristics (paperback)
ISBN: 0321774965
EAN: 2147483647
Year: 1996
Pages: 180

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