Dec 4, 2014 at 1:56pm
cheers
Last edited on Dec 4, 2014 at 3:50pm
Dec 4, 2014 at 2:16pm
what am I doing something wrong? |
There is nothing wrong with it. That's the way
union
work. And yes: it's a good idea to have the type of the code.
You cannot change the enum (at runtime), but you can very well change the value of
charType
[EDIT] The second struct is supposed to look like this:
1 2 3 4 5 6 7 8 9 10 11 12
|
struct CharacterNode
{
union charCode
{
char AsciiCode;
unsigned char EbcdicCode;
unsigned short UnicodeCode;
} CharCode; // Note
enum CharType { ASCII, EBCDIC, UNICODE } charType; // Note
};
|
You can use both
Last edited on Dec 4, 2014 at 2:19pm