, , class B .
For example, it B.cppmay include header files that it B.hppdoes not have, which can significantly affect the build process for large projects.
But even without a separate translation unit, you can sometimes have a cyclical dependency, which is resolved by separating the definitions. For example, a function can take a type parameter that was previously declared before B was defined, and then determined by the time that the function was defined. If this type uses the definition of B in its own definition, it cannot simply be defined before B.
source
share