hi,

say i have this rather large class, which (in a way) somehow resembles a custom dialog control). This control is supposed to display data, which it does just fine. To do so, it maintains a

byte settings[10];

array, which holds information on how to display the data.

There are multiple ways to represent this custom set of data.
In order to remain flexible in representing it, i thought of implementing some sort of DisplayProvider, which can be registered to the base class and provides that settings byte array.

Preferably, i would now have a set of static const instances of this provider.
Using a struct would work nicely here:

PHP Code:
struct DisplayProvider
{
int settings[10];
}

static const 
DisplayProvider prov1 = {1,2,3,4,5,6,7,8,9,0}; 

The problem: The DisplayProvider would have to do some pre-processing, before handing over control to the base class, which then does the main work.
I would end up with something like this:


PHP Code:
class DispalyProvider
{
baseclassowner;
 
int settings[10];
void PreProcessing(...);//ends up calling the owner.Processing(...) function
}; 

I am not the greatest fan of having that owner pointer, but there` s probably no way around that.
The main thing here is, that i dont really see a way to create a stock of default "static const DisplayProvder = {...}"s, as i could when using a struct.

Note that this a simplified example, i hope it shows the problem well enough...because i dont really see any good solution to this. :S