ok so my c++ is a little rusty, and im trying to do something new here and that is making a class that needs to have a constant static character pointer array. now i need help on how to intialise this array, my class is something like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
class abc{
private:
...
staticconstint *ptrarr[5];
...
};
//want to initialize this constant static array of pointers here.what im trying is something like this. i know the syntax is wrong(which is why im asking this questions) but it should give an idea of what i am trying to do.
constint abc::ptrarr[0]=newint [2];
constint abc::ptrarr[0][0]=3;
constint abc::ptrarr[0][1]=5;
constint abc::ptrarr[0][2]=7;
....
thanks in advance. any help will be appreciated.. and believe it or not, if been trying to figure this out for an hour now :/...
Hello,
well, I tried do this thing you're trying to do but wasnt able to do that but..
Do u really need 2 dimensional array? if one would be enough there is simple way do do this:
1 2 3 4 5
class Object
{
conststaticint staticIntArray[]
};
constint Object::staticIntArray[] = {0,1,2,3};
if u really need a two dimensional array this initizalitation works for me but i there's problem - i am unable to put any values into the array >_<
1 2 3 4 5
class Object
{
conststaticint *staticIntArray[];
};
constint *Object::staticIntArray[] = {newint[1],newint[3]};