Last Updated: June 6, 2026
The Pimpl idiom (short for "pointer to implementation") hides a class's private members behind an opaque pointer so that the header file exposes only what callers need. The payoff is faster builds, fewer recompiles when internal details change, and a stable binary interface across library versions. This lesson covers the classic raw-pointer form, the modern std::unique_ptr form, the subtle destructor rule that causes a common error, and the trade-offs that decide when Pimpl is worth the indirection.