I am looking for the correct way to initialize an array data member and why the following code produces the listed error.
Thanks...
typedef struct tagsX
{
tagsX(int u, int v): a(u), b(v) {}
int a ;
int b ;
} sX ;
typedef struct tagsY
{
tagsY(sX *p, sX *q): c(p), d(q) {}
sX *c ;
sX *d ;
} sY ;
class Z
{
public:
Z() ;
sX e ;
sX f ;
sX g ;
sX h ;
sY i[2] ;
};
Z::Z() :
e(0,0)
, f(0,0)
, g(0,0)
, h(0,0)
, i( ( &e, &f ),
( &g, &h ) )
{ // error C2536: 'Z::i' : cannot specify explicit initializer for arrays
}