开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜