Code:
class winStrct_T
{
public:
struct COLOR{
int r;
int g;
int b;
} BLACK, WHITE, GREEN, BLUE;
int set_colours(int color, int r, int g, int b);
protected:
int tmpVar;
}winStrct;
int winStrct_T::set_colours(int color, int r, int g, int b)
{
switch(color){
case 1:
//set BLACK
break;
case 2:
//set WHITE
break;
case 3:
//set GREEN
break;
case 4:
//set BLUE
break;
default:
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Don't use four different structs, it just takes up unneeded space. Instead create a struct with a generic name and create four instances of it, one for each color. Then you can set the colors for each instance by taking a parameter to set_colours and using a switch to determine which instance to use.