Re: observing dealloc
Re: observing dealloc
- Subject: Re: observing dealloc
- From: Ken Tozier <email@hidden>
- Date: Tue, 29 May 2007 00:08:39 -0400
On May 28, 2007, at 11:28 PM, Chris Hanson wrote:
One further distinction to make is whether you're dealing with true
"class variables" or with "class instance variables." A class can
be thought of as just another object; a class instance variable is
an instance variable of the class object. The difference between
the two is that if you have class A and class B which is a subclass
of A, they each share the *same* class variables but because each
class is a distinct object they each get *their own copy* of each
class instance variable.
Let me see if I have this right. Given two classes "MyBaseClass" and
MySubClass
@interface MyBaseClass : NSObject
@end
@implementation MyBaseClass
NSMutableDictionary gGlobals = nil;
+ (void) initialize
{
if (gGlobals == nil)
{
gGlobals = [[NSMutableDictionary alloc] init];
}
}
@end
@interface MySubClass : MyBaseClass
@end
MyBaseClass *a = [[MyBaseClass alloc] init];
MySubClass *b = [[MySubClass alloc] init];
The "gGlobals" variable for "a" would be distinct from the "gGlobals"
for "b" correct?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden