Mail Archives: djgpp/1997/05/31/19:40:49
I am making a class which has some class members declared with const.
They are initialized directly in the class declaration. I thought this
couldn't be done, but it worked until I tried to use arrays. Some of the
constant variables declared in the class are arrays, both single- and
multidimensional. I can initialize them and the compiler doesn't say
anything, but when I try to use them the LINKER starts complain, and
says there's an undefined reference. I don't understand, could somebody
help?
Example
class foo
{
private:
foo();
void test();
private:
const short foovar=200; // <- This works
const short footest[13]={0,1,2,3,4,5,6,7,8,9,10,11,12}; // <- This
doesn't work
const short dummyfoo[2][9]={{0,1,2,3,4,5,6,7,8},
{0,1,2,3,4,5,6,7,8}}; // <- This doesn't work
};
Please help me!
Thanks
--
***************************************
Internet : Henrik DOT Baarnhielm AT abc DOT se
Fidonet : Henrik Baarnhielm, 2:201/235
***************************************
- Raw text -