Is this a good code (came across while reading code of a colleague)
<p>File <code>a.hpp</code>:</p>

<pre><code>class a;
typedef boost::shared_ptr&lt;a&gt; aPtr

class a{
public:
    static aPtr CreateImp();
    virtual void Foo() = 0 ;
    ....
};
</code></pre>

<p>File <code>aImp.hpp</code>:</p>

<pre><code>class aImp : public a{

    virtual void Foo();

};
</code></pre>

<p>File <code>aImp.cpp</code>:</p>

<pre><code>aPtr a::CreateImp()
{
     return aPtr(new aImp());
}

void aImp::Foo(){}
</code></pre>

<p>The client must use <code>CreateImp</code> to get pointer to <code>a</code>, and can't use <code>a</code> other ways.
What do you think about this implementation?
What do you think about this kind of implementation?</p>
