initialising an array inside a class
hello, i need to initialise a constant character array inside a class....
ie. it needs to be same for all class members
i tried something like this, but it seems to be a wrong method... can someone guide me
1 2 3 4 5 6 7 8 9 10
|
class abc
{
private:
.
.
static const char def[10] = {x,x,x,x,x,...};
.
.
}
|
You should place initialization outside the class definition. For example
1 2 3 4 5 6 7
|
class abc
{
private:
static const char def[10];
};
const char abc::def[10] = "I'm here";
|
thank you
Topic archived. No new replies allowed.