[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
static array initialization
From: |
Aurelien |
Subject: |
static array initialization |
Date: |
Mon, 3 Sep 2001 21:22:47 +0200 |
Hi,
Another beginner's question (c'mon they're easy to answer ;-):
I want to have class (static) fields in the form of an array. Hence I
declare them as static just above the @interface declaration:
#import "ClassFactory.h"
@class Advertisement, MimeMediaType, AdvertisementFactory
static Class advRequiredConstructors [][];
static NSObject advRequiredStaticMethods [][];
static int getAdvertisementTypeMethod = 0;
@interface AdvertisementFactory: ClassFactory
{
....
}
....
To initialize these variables, I declare a class method named:
+ doStatic;
To have my class initialized, I'll have to call the doStatic method on
each class that has a such method.
My question comes in three parts:
1) Isn't there a standard way to do this (e.g. using the + alloc
method) ?
2) in the body of this method, how do I initialize an array of an array
of NSObjects. Do I have to use malloc ?
3) Will I have to manually free the allocated pointers ?
thx in advance,
Aurélien
- static array initialization,
Aurelien <=