Code hiding
Author |
Message |
apomb
|
Posted: Mon Apr 25, 2005 4:54 pm Post subject: Code hiding |
|
|
kk, heres my question: is code hiding, using header files, implementation files and interface files a "necessary" way of programming ... because im pretty sure there are other ways of writing code without hiding it all in implementation files if not, well, then i guess i can adapt my thinking, but if so, why the hell dont they teach it in school?? my teacher thinks he has the answers but there just not good enough to appease my suspicions ... thanks in advance (wtd probly) |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Mon Apr 25, 2005 8:09 pm Post subject: (No subject) |
|
|
Use header files and implementation files where appropriate. Header files (*.h) do not contain executable code. Type declarations, class interfaces, global variables, and forward declarations of functions belong in header files. Also, "implementation" of templated functions and class members belong in header files, since a template itself doesn't constitute executable code in C++.
Everything else should go in an implementation file (*.c).
Always remember to use #ifndef #define ... #endif to protect your header files against multiple includes. |
|
|
|
|
|
apomb
|
Posted: Tue Apr 26, 2005 10:07 am Post subject: (No subject) |
|
|
aahh, thank you for clearing that up for me ... i am aware of the #ifndef, #define ... #endif in header files. Alright, i understand the whole process now... it was just my teachers explanation of "code hiding" and how it is how "they" all do it now. |
|
|
|
|
|
|
|