Maybe there is a better solution without using unions. What do you want to do?
The only "work around" would be to use an char array or an pointer to a string. But it would be very dangerous if you used that pointer if it's actually something else...
@onur
Yeah man, I was using pointer before but then I had to switch to strings. And now my code is full of strings in almost every class. Finally, I ended up using char * instead of unions. And storing my data in that pointer using memcpy.
you can use a struct if thats feasible, union cant work with string class.
i think no class object will go inside a union because even if you dont define a copy const/assignment opt, compiler will do that for you.