class one {
public :
int a;
};
class two ublic one{
public:
int d;
}
class test {
union{
one a;
};
};
int main(){
test obj;
obj.a.d=10;
printf("%d",a.d);
return 0;
}
My problem is i need to have a class object in an union,[since there is a rule that union cannot contain members with constructors], so i created a dummy class one to overcome this,..
Error:
undefined variable d.
how to solve this...
public :
int a;
};
class two ublic one{
public:
int d;
}
class test {
union{
one a;
};
};
int main(){
test obj;
obj.a.d=10;
printf("%d",a.d);
return 0;
}
My problem is i need to have a class object in an union,[since there is a rule that union cannot contain members with constructors], so i created a dummy class one to overcome this,..
Error:
undefined variable d.
how to solve this...