Well, I wouldn't use it. I have a better alternative:
foo.h:
class Foo {
public:
virtual ~Foo() { }
virtual void someMethod() = 0;
// This "replaces" the constructor
static Foo *create();
}
foo.cpp:
namespace {
class FooImpl: virtual public Foo {
public:
void someMethod() {
//....
}
};
}
Foo *Foo::create() {
return new FooImpl;
}
Does this pattern have a name?
As an also Python and Java programmer, I like this a lot more than the pImpl idiom.