Is there a pattern name for a factory method that returns another instance of the interface's class?
Is there a design pattern or idiom for a factory method on an interface that returns a new instance of the same interface? For example, in C++ it might look like:
class IFoo
{
public:
virtual std::auto_ptr<IFoo> Operation();
};
Where the Operation
method for som开发者_C百科e concrete subclass of IFoo creates and returns a new instance of a (potentially different) concrete subclass of IFoo.
精彩评论