I would like to have a static char array member initialized in terms of other static char array members - but the initialization is such that code is necessary. Is this possible?
class fred {
static char *a;
static char *b;
static char c[4];
}
Now a and b will have fixed values, but I want to construct c in terms of them. EG:
fred::a = "1234"
fred::b = "ab"
strcpy(c, b);
strncat(c, a, 1);
However I can't see anyway to initialize c, other than to make a class for the purpose which is just a char[4], with a constructor that references fred::a and fred::b, and then replace c in fred with an instance of that class - which is awkward when referencing the c char array.
Is there a better way?