i an new in Object-C. i want to know how to define a static class variable. i code this based on one book:
static int count = 0; // staic class variable
@interface ClassA : NSObject{
}
+(int) initCount;
+(void) initialize;
@end
@implementation ClassA
-(id) init{
if(self = [super init]){
count++;
}
return self;
}
+(int) initCount{
return count;
}
+(void) initialize{
count = 0;
}
@end
you know, the variable count
not in ClassA, could i define the staic class variable like C++?
in C++, we can define like this:
@interface ClassA : NSObject{
static int count;
}