Is it possible to define a union at creation. ie:

union Colour
{
   unsigned int i;
   char c[4];
   struct{
      char a;
      char r;
      char g;
      char b;
   }col;
}Black(0xFF000000),White(0xFFFFFFFF),Red(0xFFFF0000),Green(0xFF00FF00),Blue(0xFF0000FF)/*etc...*/;

Assuming I understand your question, yes.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.