Hello,
I don't know how to initialize a static pointer array in a class.
I wish to write something like the following code only with a class:
Code:
struct Test{
int xCount;
};
int main(){
Test * myCounter[10];
myCounter[0] = new Test;
(*myCounter[0]).xCount = 0;
}
Here is the last thing I have tried... but it doesn't compile:
Code:
//myClass.h
class myClass{
protected:
static struct Test { int xCount; } * myCounter[10];
};
//myClass.cpp
#include "myClass.h"
myClass::Test myClass::*myCounter[0] = new myClass::Test;
Obviously I have left out lots of stuff (i.e. constructor) from the class code here but I am only having problems getting this thing initialized and getting the correct code written for "(*myCounter[0]).xCount = 0;" in my class.
Any help or suggestions would be greatly appreciated!
Thanks!