Chapter 13. Composite

You can picture a composite as an entity that contains other entities of the same kind. The whole bundle is like a tree with connected entities of parents and children. It's like a family tree of the same ancestry. Every node (child) in the family tree has the same family name. For other people who want to refer to my family, they need to refer to the Chungs. So every member in my family should be covered. So if a question like "Hey, Chungs, would you please give me your $5?" was asked, then every member would shell out $5. Requests can go recursive if we ask, "Chungs, would you please give me a total number of members in the family?" We assume the great-grandfather of the family will receive the message; the operation will ...

Get Pro Objective-C Design Patterns for iOS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.