November 1999
Intermediate to advanced
240 pages
5h 22m
English
Difficulty: 6
Now that the unnecessary headers have been removed, it's time for Phase 2: How can you limit dependencies on the internals of a class?
Below is how the header from Item 26 looks after the initial clean-up pass. What further #includes could be removed if we made some suitable changes, and how?
This time, you may make changes to X as long as X's base classes and its public interface remain unchanged; any current code that already uses X should not be affected beyond requiring a simple recompilation.
// x.h: sans gratuitous headers // #include <iosfwd> #include <list> // None of A, B, C or D are templates. // Only A and C have virtual functions. #include "a.h" // class A #include ...
Read now
Unlock full access