D
DeMarcus
Let's say we're gonna make a system library and have a class with
two prerequisites.
* It will be used _a_lot_, and therefore need to be really efficient.
* It can have two different implementations. (e.g. Unix/Windows)
I feel stuck. The only solution I've seen so far is using the
design pattern 'abstract factory' that gives me a pointer to a pure
virtual interface (which can have whatever implementation). But that
forces me to make a memory allocation every time I need an instance
of that class! That's all but efficient.
Do I have to live with this? Or do I have to make some kind of
class SystemThing
{
....
private:
strange_unix_var uv;
strange_win_var wv;
}
and then use the appropriate variable in the library implementation?
How is this problem commonly solved?
Thanks
Daniel Marcus
two prerequisites.
* It will be used _a_lot_, and therefore need to be really efficient.
* It can have two different implementations. (e.g. Unix/Windows)
I feel stuck. The only solution I've seen so far is using the
design pattern 'abstract factory' that gives me a pointer to a pure
virtual interface (which can have whatever implementation). But that
forces me to make a memory allocation every time I need an instance
of that class! That's all but efficient.
Do I have to live with this? Or do I have to make some kind of
class SystemThing
{
....
private:
strange_unix_var uv;
strange_win_var wv;
}
and then use the appropriate variable in the library implementation?
How is this problem commonly solved?
Thanks
Daniel Marcus