union

Error: copy assignment operator not allowed in union

I am compiling the code below when the following erro comes up. I am unable to find the reason. typedef union { struct { const int j; } tag; } X; int main(){ return 0; } error: member `<`anonymous union>::`<`anonymous struct> `<`anonymous union>::tag with copy assignment operator not allowed in union This code c...

C++: unions with methods?

Is there anything wrong with a union having one or more methods? Or anything to watch out for? (I can see constructors/destructors being problematic for schizophrenic reasons) ...