Graphics Programs Reference
In-Depth Information
the message
copy
to an existing instance. Copying a channel will mean that its
title
,
infoString
, and
items
array are copied into a new instance of
RSSChannel
.
Now, you may be thinking, “If you copy the
items
array, aren't you just duplicating all
of the
RSSItem
s in it?” Nope. An array only keeps references to the objects that it con-
tains, so by copying an array, you are just copying the addresses of each object into the
new array, not the objects themselves (
Figure 29.6
).
Figure 29.6 Copying an RSSChannel
In
RSSChannel.h
, declare that this class conforms to
NSCopying
.
@interface RSSChannel : NSObject
<NSXMLParserDelegate, JSONSerializable, NSCoding
, NSCopying
>