PImpl
Explore the PImpl idiom in this lesson to understand how separating a class's implementation details into a hidden, pointer-accessed class improves compile times and encapsulation. Learn the advantages and trade-offs of using PImpl in C++ software design to better manage large projects and reduce build dependencies.
We'll cover the following...
Overview
Suppose that we have a class with the name Weather. Let’s assume that this class is used by many other classes with hundreds of lines of code. Any changes made to the Weather class (even if they are just to one line) will cause recompilation of the Weather class, plus all the classes (that have hundreds of lines of code) that use the Weather class. As we can see, this behavior is undesirable and can waste a lot of time. PImpl is the idea we use to tackle this situation. ...