J
Jeffrey
My understanding is that if you write
class X {
int y;
static int z;
};
then you've defined (and declared) X and y, but you have only declared
(and not defined) z. If you'd like to actually define z, you also
need to add
int X::z;
Can anybody tell me the reason that the language was designed to be
like this? It seems it would be simpler if z were defined in the same
way as y, so presumably there's some good reason.
class X {
int y;
static int z;
};
then you've defined (and declared) X and y, but you have only declared
(and not defined) z. If you'd like to actually define z, you also
need to add
int X::z;
Can anybody tell me the reason that the language was designed to be
like this? It seems it would be simpler if z were defined in the same
way as y, so presumably there's some good reason.