Forward declarations are needed to reduce compile-time dependencies. For instance, when implementing Pimpl idiom.
One more case is that, for instance, boost::pool
* depends on windows.h
on Windows platform. When creating my interface I don't want to force the users of my class to include the system headers by using my interface.
*Ok, that's a bad example, because boost/poolfwd.hpp
still includes windows.h
, but I hope they'll fix this issue. And I hope you get the idea.