Gold Challenge: Another Class

Create a subclass of BNRItem named BNRContainer. A BNRContainer should have an array of subitems that contains instances of BNRItem. Printing the description of a BNRContainer should show you the name of the container, its value in dollars (a sum of all items in the container plus the value of the container itself), and a list of every BNRItem it contains. A properly-written BNRContainer can contain instances of BNRContainer. It can also report back its full value and every contained item properly.

Get iOS Programming: The Big Nerd Ranch Guide 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.