Abstract
In the previous chapter, you got hip to inheritance, a way to set up a relationship between two classes that removes the need for a lot of duplicated code. And we (briefly) mentioned that you can also set up relationships using composition, which is the subject of this chapter. You can use composition to combine objects so they can work together. In a typical program, you’ll use both inheritance and composition when creating your own classes, so it’s important to have a good handle on both concepts.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2009 Mark Dalrymple and Scott Knaster
About this chapter
Cite this chapter
Dalrymple, M., Knaster, S. (2009). Composition. In: Learn Objective-C on the Mac. Apress. https://doi.org/10.1007/978-1-4302-1816-6_5
Download citation
DOI: https://doi.org/10.1007/978-1-4302-1816-6_5
Publisher Name: Apress
Print ISBN: 978-1-4302-1815-9
Online ISBN: 978-1-4302-1816-6
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)