Hi I wanted know the reasons of the following code
void main()
{
class test
{
public:
test(){}
int k;
};
class test1
{
public:
test1(){}
int k;
};
union Test
{
test t1;
test1 t2;
};
}
For the Above code it gives error "error C2620: union 'Test' : member 't1' has user-defined constructor or non-trivial default constructor"
class test
{
public:
//test(){}
int k;
};
class test1
{
public:
//test()1{};
int k;
};
union Test
{
test t1;
test1 t2;
};
For the Above, No Errors.
I wanted to know the Reasons.
Thank you in Advance. :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…