4 ms·
There are some (rare) occasions, when private members drag new dependencies that you don't want the user of your class to know about. You can also do "pImpl",
by Ace17 9y ago
There are some (rare) occasions, when private members drag new dependencies that you don't want the user of your class to know about.
You can also do "pImpl", which is similar, if not worse, in terms of boilerplate, but doesn't allow DI.
Just don't use these techniques unless you can prove they're needed (e.g private members drag new problematic dependencies, #include <some_volatile_header_file.h>).