I separated my statements (.h) of my definitions (.cpp). In the header files .h, I expected statements (class foo; ) as soon as I can and I did that include in the .cpp.
That's what I tend to do, the big problem is with the templates.
For simple templates, all in the same file .h. For more complex templates, do not hesitate to separate declaration and definition. Also separate when a template based on classes/or other policies occurs.
Personally, I assume that files class declaration should contain only the headers and documentation.
With of course a single class per file. Otherwise it was quick to get lost.
Moreover, it is possible that there are conflicts (including twice the same function) without this technique.
I do not see how that is possible when you use the technique:
Code:
# ifndef foo_HH
#define foo_HH
/ / / ...
# endif / *!foo_HH * /
Bookmarks