No. While language features used (pointers, private fields) may be similar, intended result is completely different.
PIMPL fairly transparent to the user of the class - and that's the point. You don't see CookPimpl
used in interface of the Cook
- it's hidden in .cpp
file, caller can't even do anything meaningful to it.
Builder class on the other hand is self-sufficient, and could be used directly, in Cook
class or in PizzaRestaurant
.
What is more, PIMPL idiom is C++-specific (adding or removing private member leads to recompilation everywhere, since definitions are copy-pasted), while design patterns strive to be language agnostic.