S
Sebastian Faust
Hi,
I read about the Loki::Factory and Loki::AbstractFactory in the book Modern
C++ Design and couldnt figure out one thing:
If I have several classes, for example the following hierarchie:
clase Base
{
public:
Base(Base* pBase) : _pBase(pBase) { }
protected:
Base* _pBase;
};
template<typename T, const T myT>
class Derived : public Base
{
protected:
T _t;
}
Now I define the following TList:
TYPELIST_3(Derived<int, 1>, Derived<string, "Hello">, Derived<int, 9>)
my_list;
And now I wanna create all the Objects in in the List connected in the chain
of responsibility, that means after the creation I wanna have the following
structure:
Derived<int, 1> --> Derived<string, "Hello"> --> Derived<int, 9> --> NULL
And the factory should return to me a pointer to the beginning so that means
to: Derived<int, 1>.
Ist such a behavior possible with the Loki::AbstractFactory or
Loki::Factory, or do I have to create my own?
Thanks in advance
Sebastian
I read about the Loki::Factory and Loki::AbstractFactory in the book Modern
C++ Design and couldnt figure out one thing:
If I have several classes, for example the following hierarchie:
clase Base
{
public:
Base(Base* pBase) : _pBase(pBase) { }
protected:
Base* _pBase;
};
template<typename T, const T myT>
class Derived : public Base
{
protected:
T _t;
}
Now I define the following TList:
TYPELIST_3(Derived<int, 1>, Derived<string, "Hello">, Derived<int, 9>)
my_list;
And now I wanna create all the Objects in in the List connected in the chain
of responsibility, that means after the creation I wanna have the following
structure:
Derived<int, 1> --> Derived<string, "Hello"> --> Derived<int, 9> --> NULL
And the factory should return to me a pointer to the beginning so that means
to: Derived<int, 1>.
Ist such a behavior possible with the Loki::AbstractFactory or
Loki::Factory, or do I have to create my own?
Thanks in advance
Sebastian