class one {
public :
int a;
};
class two :public 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...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.