Re: Apple's excellent documentation on class clusters
Re: Apple's excellent documentation on class clusters
- Subject: Re: Apple's excellent documentation on class clusters
- From: "Craig S. Cottingham" <email@hidden>
- Date: Wed, 2 Jan 2002 16:03:54 -0600
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday, January 2, 2002, at 03:56 , Erik M. Buck wrote:
----- Original Message -----
From: "Craig S. Cottingham" <email@hidden>
[Deleted]
IOW, using the MonthArray
example from the document, how should I create instances of
MonthArray in the same transparent way as other NSArray
instances? I can take a guess at how it should be done, but I'd
rather the documentation state how explicitly.
There are two answers.
First, the particular initializer in the cluster's abstract cover class
usually determines which private subclass is actually instantiated.
NSString's -initWithCString: and -initWithString: methods probably use
different private subclasses of NSString in their
implementation. After
creating a subclass of a class cluster as was done in the MonthArray
example, and additional initializer such as -initWithMonths can
be added to
the NSString class using a category.
That was my guess.
The -initWithMonths initializer
creates an instance of MonthString. In that way, the existence of the
MonthString class can be "hidden" to the same extent other
subclasses of
NSString are hidden.
See? While Apple's documentation on this topic is very good, you
managed to improve on it.
- --
Craig S. Cottingham
email@hidden
PGP key available from:
<
http://pgp.ai.mit.edu:11371/pks/lookup?op=get&search=0xA2FFBE41>
ID=0xA2FFBE41, fingerprint=6AA8 2E28 2404 8A95 B8FC 7EFC 136F
0CEF A2FF BE41
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (Darwin)
Comment: For info see
http://www.gnupg.org
iD8DBQE8M4PPE28M76L/vkERAiveAJ9o9Gpo/73Ft0fjJDbT52mem8A3VQCeNTsT
GfJIKefxJt7/UwoZScbQppU=
=WWXL
-----END PGP SIGNATURE-----