J
Javi
Hello there!.
I would like to create a class with an array as attribute. This array
is the same for all the objects so I'd like to declare it as static,
but the problem is: where and how should I define the elements of the
array, in the constructor?.
I've tried the following code but It doesn't work at all:
class hamiltonian{
private:
matrix** operators; //OK. perfect
int alpha; //Perfect, of course;
static double coeffs[5]={1,1,1,0.5,0.5} // Here comes the crash
public:
/* destructor */
/* constructor */
}
Please, can anybody tell me how to declare/define a static array of
doubles within a class?.
Thanks everybody.
I would like to create a class with an array as attribute. This array
is the same for all the objects so I'd like to declare it as static,
but the problem is: where and how should I define the elements of the
array, in the constructor?.
I've tried the following code but It doesn't work at all:
class hamiltonian{
private:
matrix** operators; //OK. perfect
int alpha; //Perfect, of course;
static double coeffs[5]={1,1,1,0.5,0.5} // Here comes the crash
public:
/* destructor */
/* constructor */
}
Please, can anybody tell me how to declare/define a static array of
doubles within a class?.
Thanks everybody.