C
C. J. Clegg
If I have...
class ParentClass
{
static int aStaticVar;
};
class ChildClass : public ParentClass
{
static int aStaticVar;
};
.... should the two instances of aStaticVar be the same variable, i.e.
occupy the same memory address?
I understand that in all objectss of ChildClass, aStaticVar will be
the same memory address, and likewise in all objects of ParentClass,
but as between an object of ParentClass and an object of ChildClass, I
would have thought that aStaticVer would be unique.
It doesn't appear to be working that way in g++ version 2.95.
class ParentClass
{
static int aStaticVar;
};
class ChildClass : public ParentClass
{
static int aStaticVar;
};
.... should the two instances of aStaticVar be the same variable, i.e.
occupy the same memory address?
I understand that in all objectss of ChildClass, aStaticVar will be
the same memory address, and likewise in all objects of ParentClass,
but as between an object of ParentClass and an object of ChildClass, I
would have thought that aStaticVer would be unique.
It doesn't appear to be working that way in g++ version 2.95.