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