Boost logo

Boost :

From: Nicola Musatti (Nicola.Musatti_at_[hidden])
Date: 2002-06-26 09:11:41

Phil Nash wrote:
> Of course, you may disagree and suggest that the factory method is a
> solution rather than a work around, and my concept is misguided - in which
> case I am open to persuasion :-)

I'll state just this: a car factory is *not* a car :-)

More seriously, it really depends on the architecture of your
application and on how your objects are created. If your object has all
the knowledge required to create its elements it seems a pity to move
creation outside; on the other hand if you have to pass this knowledge
e.g. to the object constructor it might not make such a difference to
pass the elements instead.

On the other hand this last approach will probably make it necessary to
supply the elements after the main objects is constructed: after all you
can't acquire ownership before that. This in turn means that your object
is capable of "living" without its elements.

Nicola Musatti

Boost list run by bdawes at, gregod at, cpdaniel at, john at