3 ms·
Maybe I am misunderstanding, but I thought the point of headers is to avoid writing things twice (or more).
by vonmoltke 11y ago
Maybe I am misunderstanding, but I thought the point of headers is to avoid writing things twice (or more).
- pjmlp 11y agoOn the header file you write the function interface and class definitions. On the implementation file you have again to repeat those plus the actual implementation. On many languages with module support, you just mark whatever symbol with public, that's it.
- vonmoltke 11y agoOK, you meant specifically the source/header split on classes in languages like C++. Yeah, there is definitely redundancy there that gets eliminated by headers. I also think I may have been conflating "header" with "include file" to a greater degree than is appropriate.