I
iceColdFire
Hi @all,
I am trying to include struct and class objects in a union ,like
class A{
int a;
A(){}
};
struct B
{
int b;
B(){}
};
union U
{
A ao;
B bo;
int i;
char r;
};
However, the above construction is flagged as error, now if I remove
the constructors from the above class and struct , the error is no
more....
I need some explanation , as why is this happening ...
Is it possible that somehow constructors change the way an object is
represented in memory...
Thank,
a.a.cpp
I am trying to include struct and class objects in a union ,like
class A{
int a;
A(){}
};
struct B
{
int b;
B(){}
};
union U
{
A ao;
B bo;
int i;
char r;
};
However, the above construction is flagged as error, now if I remove
the constructors from the above class and struct , the error is no
more....
I need some explanation , as why is this happening ...
Is it possible that somehow constructors change the way an object is
represented in memory...
Thank,
a.a.cpp