use class objet instead of an instance object
use class objet instead of an instance object
- Subject: use class objet instead of an instance object
- From: "Ivan S. Kourtev" <email@hidden>
- Date: Mon, 2 May 2005 15:58:09 -0400
Hi all,
I would like to use a class' object to indicate certain conditions (and
be able to handle it like a regular object, put it in collections,
etc.). I tried having something like that:
@interface Foo : NSObject { ... }
@end
@interface BadFoo : Foo {}
@end
and then using BadFoo instead of a Foo instance to indicate some error
condition, for example. So I now know this cannot be done, because the
BadFoo class object is not of type id and can only stand for the class
object as the receiver in a message expression (p. 47 of the ObjC
manual). For example, I cannot do
NSArray* a = [NSArray arrayWithObject:BadFoo];
but I can do
NSArray* a = [NSArray arrayWithObject:[BadFoo class]];
Is there any way to implement this idea without having to retype
[BadFoo class] all the time? Or am I trying to do something stupid
that doesn't make sense?
Thanks for any help!
--
ivan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden