Hello everyone,
I have a problem on how to implement an array of functions like it would look like in C++ code:
static Item* (*chunkProcs[nrOfItemTypes])(QDataStream* in) = {
Item::createFromStream,
ItemB::createFromStream
};
How should this look like in Objective-C ?
I tried something like this:
static Item* (*chunkProcs[nrOfItemTypes])(NSMutableData* in) = {
[Item createFromStream],
[ItemB createFromStream]
};
and used this array like this:
Item* item = chunkProcs:in;
But this gives me an "initializer element is not constant" error.
Can somebody help me with this?
Peter
I have a problem on how to implement an array of functions like it would look like in C++ code:
static Item* (*chunkProcs[nrOfItemTypes])(QDataStream* in) = {
Item::createFromStream,
ItemB::createFromStream
};
How should this look like in Objective-C ?
I tried something like this:
static Item* (*chunkProcs[nrOfItemTypes])(NSMutableData* in) = {
[Item createFromStream],
[ItemB createFromStream]
};
and used this array like this:
Item* item = chunkProcs:in;
But this gives me an "initializer element is not constant" error.
Can somebody help me with this?
Peter