I have a class that I need to have an CString and doubles, but I am not
getting the desired effect... i.e., I think that the class member arrays are
not being initialized, only arrays local to the constructor.

I need to perform lookups, i.e.

CNecTblImpedence tbl;
x=4;
tbl.dXSteel[4] + tbl.dRSteel[x] ;

etc..

I thought arrays would be easy enough... what am I doing wrong? I want the
in the CNecTblImpedence class, as I may be adding some member functions
later.

class CNecTblImpedence
{
public:
CNecTblImpedence();
virtual ~CNecTblImpedence();

static CString strSize[21];
static double dXSteel[21];
static double dRSteel[21];
};


CNecTblImpedence::CNecTblImpedence()
{
// data from NEC 2002 Table 9
// dRSteel and dXSteel are in Ohms/1000'

CString
strSize[]={"14","12","10","8","6","4","3","2","1","1/0","2/0","3/0","4/0","2
50","300","350","400","500","600","750","1000"};
double
dXSteel[]={0.073,0.068,0.063,0.065,0.064,0.060,0.059,0.057,0.057,0.055,0.054
,0.052,0.051,0.052,0.051,0.050,0.049,0.048,0.048,0.048,0.046};
double
dRSteel[]={3.1,2.0,1.2,0.78,0.49,0.31,0.25,0.20,0.16,0.12,0.10,0.079,0.063,0
.054,0.045,0.039,0.035,0.029,0.025,0.021,0.018};

}

Re: Class Array Initialization by Roger

Roger
Wed Aug 13 14:00:27 CDT 2003

try this syntax to initialize static members:

class CNecTblImpedence
{
public:
CNecTblImpedence();
virtual ~CNecTblImpedence();

static CString strSize[21];
static double dXSteel[21];
static double dRSteel[21];
};

CString
CNecTblImpedence::strSize[21]={"14","12","10","8","6","4","3","2","1","1/0",
"2/0","3/0","4/0","250","300","350","400","500","600","750","1000"};
double
CNecTblImpedence::dXSteel[21]={0.073,0.068,0.063,0.065,0.064,0.060,0.059,0.0
57,0.057,0.055,0.054,0.052,0.051,0.052,0.051,0.050,0.049,0.048,0.048,0.048,0
.046};
double
CNecTblImpedence::dRSteel[21]={3.1,2.0,1.2,0.78,0.49,0.31,0.25,0.20,0.16,0.1
2,0.10,0.079,0.063,0.054,0.045,0.039,0.035,0.029,0.025,0.021,0.018};

CNecTblImpedence::CNecTblImpedence()
{
// data from NEC 2002 Table 9
// dRSteel and dXSteel are in Ohms/1000'


}

"Martin Schmid" <martinschmid@sbcglobal.net.nospam> wrote in message
news:OfUxyUcYDHA.1748@TK2MSFTNGP12.phx.gbl...
> I have a class that I need to have an CString and doubles, but I am not
> getting the desired effect... i.e., I think that the class member arrays
are
> not being initialized, only arrays local to the constructor.
>
> I need to perform lookups, i.e.
>
> CNecTblImpedence tbl;
> x=4;
> tbl.dXSteel[4] + tbl.dRSteel[x] ;
>
> etc..
>
> I thought arrays would be easy enough... what am I doing wrong? I want
the
> in the CNecTblImpedence class, as I may be adding some member functions
> later.
>
> class CNecTblImpedence
> {
> public:
> CNecTblImpedence();
> virtual ~CNecTblImpedence();
>
> static CString strSize[21];
> static double dXSteel[21];
> static double dRSteel[21];
> };
>
>
> CNecTblImpedence::CNecTblImpedence()
> {
> // data from NEC 2002 Table 9
> // dRSteel and dXSteel are in Ohms/1000'
>
> CString
>
strSize[]={"14","12","10","8","6","4","3","2","1","1/0","2/0","3/0","4/0","2
> 50","300","350","400","500","600","750","1000"};
> double
>
dXSteel[]={0.073,0.068,0.063,0.065,0.064,0.060,0.059,0.057,0.057,0.055,0.054
> ,0.052,0.051,0.052,0.051,0.050,0.049,0.048,0.048,0.048,0.046};
> double
>
dRSteel[]={3.1,2.0,1.2,0.78,0.49,0.31,0.25,0.20,0.16,0.12,0.10,0.079,0.063,0
> .054,0.045,0.039,0.035,0.029,0.025,0.021,0.018};
>
> }
>
>